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