1.0.0 • Published 6 years ago

isi-promise v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

Promise extensions and helpers

Methods

contructur()

contructur(maxAmount, timeout, title, promiseLib)

Options:

  • maxAmount: used to set the amount of promise instances which can run at the same time
  • timeout: used to define an interval to retry get a new slot to run a promise
  • title: title of the promise helper instance. useful to identify the current instance
  • promiseLib: put in your favorite promise lib

description comes here

How to use()

reserveSemaphore() and resolveSemaphore()

Example:

var IsiPromiseCl = require('isi-promise');
var isiprom = new IsiPromiseCl(5, 50, );

for(var i = 0; i < 500; ++i){
    isiprom.reserveSemaphore()
    .then [... do your staff here ...]
    .then( isiprom.resolveSemaphore.bind(isiprom) );
}