promisegate

0.1.2 • Public • Published

promisegate

Takes (args...) -> Promise and turns it into (args...) -> Promise with limited concurrency.
Useful for capping expensive async calls (e.g. image processing).
Arguments are proxied to the wrapped function.

Assumes your promise library of choice defines .resolve, .defer and .prototype.finally.

var Promise = require('bluebird');
var gate = require('promisegate')(Promise) // pass promise lib of your choice
 
var someFunctionReturningPromise = gate.limit(function () {
  // do work
}, 666);

But actually, it's about ethics in game journalism.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i promisegate

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • gaearon