chensenlai 10988628a0 语音房项目初始化 | преди 5 години | |
---|---|---|
.. | ||
LICENSE | преди 5 години | |
README.md | преди 5 години | |
index.js | преди 5 години | |
package.json | преди 5 години |
Promisify a callback-based function using any-promise
.
bluebird
Array
An added benefit is that throw
n errors in that async function will be caught by the promise!
var thenify = require('thenify');
var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
callback(null, a, b, c);
});
var thenify = require('thenify').withCallback;
var somethingAsync = thenify(function somethingAsync(a, b, c, callback) {
callback(null, a, b, c);
});
// somethingAsync(a, b, c).then(onFulfilled).catch(onRejected);
// somethingAsync(a, b, c, function () {});
Promisifies a function.