0.0.1 • Published 7 years ago

throvents v0.0.1

Weekly downloads
5
License
SEE LICENSE IN LI...
Repository
-
Last release
7 years ago

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' });