Starts the polling and returns a PollerUnit instance. You can track the state of polling using the PollerUnit
object and cancel the polling if necessary.
Name | Type | Description |
---|---|---|
options | Object | setup poller's properties |
pollingArgs* | * | args to pass to the polling method |
The options
parameter is used to configure polling. Allowed keys and default values are stated below. Note that either pollTask
or pollFunction
has to be present in the options
object.
pollingInterval
: elapsed time in ms between the completion of the last request and the next one. default: 1500
retryLimit
: amount of retry attempt until timeout. If you specify retryLimit as Infinity or Number.POSITIVE_INFINITY, polling should last forever. default: 40
pollTask
: the task that is to be performed on every polling attempt.
pollFunction
: an async function that is to be called on every polling attempt.
- isError
:boolean
readOnly
true if polling is failed(an exception throwed or promise rejected), false otherwise.
- isFailed
:boolean
readOnly
alias of isError
- isSuccessful
:boolean
readOnly
true if polling is succeeded(a
truthy
value is returned), false otherwise. - isRunning
:boolean
readOnly
true if polling is running, meaning it is not failed, succeeded, canceled or timed out.
- isCanceled
:boolean
readOnly
true if polling is canceled using abort() method.
- isCancelled
:boolean
readOnly
alias of isCanceled
- isTimeout
:boolean
readOnly
true if polling terminates without success, failure and cancellation.
- retryCount
:Number
readOnly
returns the number of pollings made since polling started.
Cancels the ongoing polling. Upon calling this method isCancelled
attribute is set to true.