throvents

0.0.1 • Public • Published

High level interface for request throttling via events.

Usage

const {limiter, jobs} = require('throvents');

// job may only occur once every 30 minutes (Time specified in seconds).
const L = limiter(60*30, 'fetch');

jobs.on('fetchTweets', ({id, as}) => {
    request({id, as}).then(...)
});

// Fires immediately
L({ id: 'A5CF12', as: 'csv' });

// Will fire in 30 minutes.
L({ id: 'B66E4D', as: 'json' });

Package Sidebar

Install

npm i throvents

Weekly Downloads

2

Version

0.0.1

License

SEE LICENSE IN LICENSE

Last publish

Collaborators

  • sage.gerard