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