2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
var Promise = require('bluebird/js/main/promise')();
|
2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
Promise.prototype.yield = function(value) {
|
|
|
|
return this.then(function() {
|
|
|
|
return value;
|
|
|
|
});
|
|
|
|
};
|
2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
Promise.prototype.tap = function(handler) {
|
|
|
|
return this.then(handler).yield(this);
|
|
|
|
};
|
2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
Promise.prototype.ensure = Promise.prototype.lastly;
|
|
|
|
Promise.prototype.otherwise = Promise.prototype.caught;
|
2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
Promise.resolve = Promise.fulfilled;
|
|
|
|
Promise.reject = Promise.rejected;
|
2013-10-27 22:34:58 -04:00
|
|
|
|
2013-11-27 16:51:01 -05:00
|
|
|
exports.Promise = Promise;
|