Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-limits

co-limits extends limits.js with a 'co' method. With this you can use limits.js in an co container.

Sample

var co = require('co');
var colimits = require('co-limits');
var start = Date.now();

var c = colimits({
    secondly: 1, // allow 1 call per second
    minutely: 2  // allow 2 calls per minute
}).co();

co(function* () {
    yield c;
    console.log(Date.now() - start, 'ms'); // Output: 0 ms
    yield c;
    console.log(Date.now() - start, 'ms'); // Output: 1000 ms
    yield c;
    console.log(Date.now() - start, 'ms'); // Output: 60000 ms
})();

Installation

npm install co-limits

License

Copyright (c) 2014 Simon Kusterer Licensed under the MIT license.

About

limits.js version that can be used with co

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages