Fetches data from any API in intervals
$ npm install --save dackel
$ yarn add dackel
const subscribe = require('dackel')
// logs the user-data every 10000ms to the console
const unsubscribe = subscribe('https://api.github.com/users/obi-jan-kenobi',
{
interval: 10000,
headers: {
'User-Agent': 'dackel'
}
},
(err, response, user) => console.log(user))
// stops polling
unsubscribe()
url
String (required) - url to polloptions
Object (optional) - interval in ms + request-module optionscallback
Function (required) - Recieves http-response
$ npm test
- 2.0.0
- Updated deps
- 1.1.0
- Fixed exposure
- 1.0.0
- Initial release