Constructor for creating an instance of EventPoll.
The function to be executed repeatedly.
The interval in milliseconds between each execution of the polling function.
Optional
hasToStopOnError: booleanIndicates whether to stop polling if an error occurs.
Get how many iterations have been done.
The number of iterations.
Listen to the 'data' event. This method is the redefinition of the EventEmitter.on method. Because the EventEmitter.on method does not allow to specify the type of the data. And we must be type safe.
This is equivalent to:
eventPoll.on('data', (data) => { ... });
The callback to be called when the event is emitted.
Listen to the 'error' event. This method is the redefinition of the EventEmitter.on method. Because the EventEmitter.on method does not allow to specify the type of the data. And we must be type safe.
This is equivalent to:
eventPoll.on('error', (data) => { ... });
The callback to be called when the event is emitted.
Listen to the 'start' event. This happens when the poll is stopped.
The callback to be called when the event is emitted.
Listen to the 'stop' event. This happens when the poll is stopped.
The callback to be called when the event is emitted.
Poll in an event based way. This Poll is Asynchronous. It exploits:
Example