diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-03-06 11:06:43 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-03-06 11:06:43 +0000 |
| commit | f5b9b1c8632de9f2066bc45ded336d1e04e64aab (patch) | |
| tree | c2351d3052b1bb3fc0f0d470be1786100303113e /lib/promises.js | |
| parent | 85e30f452001b5d02a617da21c72e12b206dfdb4 (diff) | |
Use bluebird instead of q for better performance
Diffstat (limited to 'lib/promises.js')
| -rw-r--r-- | lib/promises.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/promises.js b/lib/promises.js new file mode 100644 index 0000000..2dfc77a --- /dev/null +++ b/lib/promises.js @@ -0,0 +1,15 @@ +var bluebird = require("bluebird/js/main/promise")(); +var _ = require("underscore"); + +exports.defer = bluebird.defer; +exports.when = bluebird.resolve; +exports.resolve = bluebird.resolve; +exports.all = bluebird.all; + +exports.nfcall = function(func) { + var args = Array.prototype.slice.call(arguments, 1); + var promisedFunc = bluebird.promisify(func); + return promisedFunc.apply(null, args); +}; + +bluebird.prototype.fail = bluebird.prototype.caught; |
