Advanced Usage
Custom Strategies
Learn how to create and use custom fetching strategies
Custom Strategies
Waterfall-Fetch allows you to create and use custom fetching strategies to tailor the HTML retrieval process to your specific needs.
Creating a Custom Strategy
A custom strategy is a function that follows the FetchStrategyFunction
type:
Here’s an example of a custom strategy:
Using Custom Strategies
To use custom strategies, pass them as an array to the set
option when calling getHtml
:
This allows you to define the order and composition of strategies used in the waterfall approach.