Note
Archived 20th August 2024 as this is no longer supported
It's just an interval which runs mulitple functions. For example you may want to poll a settings endpoint and a status endpoint every 3 seconds. With a pollController
we can have both of these functions run of the same loop and that loop is managed in one place.
npm install pollcontroller
At the moment we are only publishing to npm.
import {createPollController} from "pollcontroller"
const frequentPoller = createPollController();
const clearFrequentActions = frequentPoller.configure({
actions: [YOUR_FUNCS],
freq: 2000,
invokeOnStart: true
});
frequentPoller.start();
This is the basic usage of the poller. There will now be one interval running ever 2 seconds, running all the actions you have supplied.
See src/index.js
for API docs.
MIT