camel-back-promise

The straw that breaks the camel's back. A function which resolve a promise after getting called n times.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
camel-back-promise
101.0.08 years ago8 years agoMinified + gzip package size for camel-back-promise in KB

Readme

CamelBack Promise

The straw that breaks the camel's back
Instantiate by passing in a deferred promise and a number n. After the CamelBackPromise is called n times, the deferred promise is resolved.
npm install camel-back-promise
var CamelBackPromise = require('camel-back-promise');

var deferred = Q.defer();
deferred.promise.then(function(){
  console.log("broke the camel's back")
});

var camelback = CamelBackPromise(deferred, 3);

camelback()
camelback()
camelback() // "broke the camel's back"