node package manager

promise-deferred

A lightweight Deferred implementation, on top of Promises/A+

promise-deferred Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

A lightweight Deferred implementation, on top of Promises/A+

Examples

var Deferred = require('promise-deferred');
 
var deferred = new Deferred();
 
// set up handlers 
deferred.promise.then(function (value) {}, function (error) {});
 
// resolve 
deferred.resolve('a value');
 
// reject 
deferred.reject(new Error('oh noes'));

Tests

Simply clone the repo, npm install, and run npm test