Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

footballradar/PollController.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

Archived 20th August 2024 as this is no longer supported

PollController.js

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.

Installing

npm install pollcontroller At the moment we are only publishing to npm.

Getting Started

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.

API

See src/index.js for API docs.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published