2 ms·
You don't need to refactor the existing code. You can change the calling code. // Promisifying a standard callback const myAsyncMethod = Bluebird.promi
by vkjv 10y ago
You don't need to refactor the existing code. You can change the calling code.
// Promisifying a standard callback
const myAsyncMethod = Bluebird.promisify(myCallbackMethod);
// Or if you have weird callback passing and need
// to manipulate the callback method being passed around
function myAsyncMethod(...args) {
return Bluebird.fromCallback(cb => myAsyncMethod(cb, ...args));
}