Poll any resource using ES6 Promises and streams.
Installation
$ npm install gallup --save
Usage
// You construct a poller by providing a poll callback as the first argument// and an optional options object as the second. The poll function may return a// normal value or an ES6 Promise to be evaluated. var poller = { return Promise} 5000 // poll every 5 seconds (default: 1 second) // Pollers are stopped by default. Starting them begins polling immediately.pollerstart // Pollers are instances of EventEmitter. When promises resolve, their values// are emitted via 'data' events. Errors are emitted via 'error' events. If the// previous poll is taking a long time to resolve, another poll will not be// initiated until the previous one completes. poller poller // You can also stop and restart polling.pollerpollerstart
Development
Gallup uses JavaScript Standard Style, Babel for ES6+ support, and Jest for testing.
$ git clone git@github.com:pavlovml/gallup.git
$ npm test
To run the tests on file changes:
$ npm test -- --watch