Trickle
If you're looking for a promise-based alternative to this module check out wyt.
Trickle limits function executions based on time. It lets you define the number of executions per a certain amount of milliseconds.
This is particularly useful to obey an API provider's rate limit, for example.
Installation
Note: trickle is called "timetrickle" on npm because someone has occupied the name before I had a chance.
npm install timetrickle --save
or manually add it to your package.json
Example
var trickle = ; start = +Date; // Helper function to show the time difference { return Math + 's'; } // Limit once per secondvar limit = ; ; ; ;
Will output:
I am doing an API call here 0s
I am doing an API call here again 1s
I am doing another API call here 2s