A Strategy is any iterable iterator which yields numbers. You can implement
it using the IterableIterator interface, i.e. implements Strategy, or you
can write a generator function which produces Generator<number>.
Examples
You can define your own generator functions or iterable iterators and pass
them as the strategy for the delay, or you can implement a class which
implements this interface. If you are able to target ES2025 (including by
using a polyfill), you can also provide subclasses of Iterator.
A
Strategy
is any iterable iterator which yields numbers. You can implement it using theIterableIterator
interface, i.e.implements Strategy
, or you can write a generator function which producesGenerator<number>
.Examples
You can define your own generator functions or iterable iterators and pass them as the strategy for the delay, or you can implement a class which implements this interface. If you are able to target ES2025 (including by using a polyfill), you can also provide subclasses of
Iterator
.Then you can use any of these as a retry strategy (note that these examples assume you have access to the ES2025 iterator helper methods):