Methods
(static) retry(fn, cycles, timeout) → {function}
Repeat a function in an interval (cycles) of given time until it returns a truthy value. Returns a cleanup function
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | the function to call |
cycles |
number | the number of cycles to retry the function call, set to -1 for infinite cycles |
timeout |
number | timeout between each call in ms |
- Source:
Returns:
a cleanup function to force-stop the interval (for example on unmount)
- Type
- function