Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Latest commit

 

History

History
69 lines (49 loc) · 1.36 KB

README.md

File metadata and controls

69 lines (49 loc) · 1.36 KB

dackel

Fetches data from any API in intervals

Build Status Known Vulnerabilities codecov

Table of contents

Installation

$ npm install --save dackel
$ yarn add dackel

Usage

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()

API

dackel(url, options, callback) -> function

  • url String (required) - url to poll
  • options Object (optional) - interval in ms + request-module options
  • callback Function (required) - Recieves http-response

Development

$ npm test

Changelog

  • 2.0.0
    • Updated deps
  • 1.1.0
    • Fixed exposure
  • 1.0.0
    • Initial release