chensenlai 10988628a0 语音房项目初始化 | il y a 5 ans | |
---|---|---|
.. | ||
LICENSE | il y a 5 ans | |
README.md | il y a 5 ans | |
index.js | il y a 5 ans | |
package.json | il y a 5 ans |
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.