Skip to content

Commit eaa4f16

Browse files
committed
Add promise pending ponyfill
Fixes #2
1 parent ae1a455 commit eaa4f16

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@ var Promise = require('bluebird');
22
var EventEmitter = require('events').EventEmitter;
33
var util = require('util')
44

5+
// pending ponyfill
6+
// http://bluebirdjs.com/docs/api/deferred-migration.html
7+
Promise.pending = function() {
8+
ret = {};
9+
10+
ret.promise = new Promise(function(res, rej) {
11+
ret.resolve = res;
12+
ret.reject = rej;
13+
});
14+
15+
return ret;
16+
};
17+
518
function PSemaphore(opts) {
619
opts = opts || {};
720

@@ -75,5 +88,4 @@ PSemaphore.prototype.add = function(work) {
7588
return work.Promise.promise;
7689
};
7790

78-
7991
module.exports = PSemaphore

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"author": "Sam Saccone",
1919
"license": "MIT",
2020
"dependencies": {
21-
"bluebird": "3.1.1"
21+
"bluebird": "^3.3.1"
2222
},
2323
"devDependencies": {
2424
"chai-as-promised": "5.1.0",

0 commit comments

Comments
 (0)