useIntervalWhen
About
Sets an interval immediately when a condition is true
Examples
Basic example
Fire callback instantly and not wait for first interval to finish
Arguments
Argument | Type | Description | Default value |
---|---|---|---|
callback | function | Function be invoked after each interval duration | undefined |
intervalDuration | number | Duration in milliseconds after which callback is invoked | 0 |
when | boolean | Only start timer when when is true | true |
startImmediate | boolean | Should the timer start immediately or no | false |
Returned Object
No return value.