promisegate
Limits promise concurrency
Last updated 6 years ago by gaearon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install promisegate 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.1.2                                ...           latest (6 years ago)

3 Versions

  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |