2015-07-01 11:43:25 +00:00
|
|
|
exports.createPromiseCallback = createPromiseCallback;
|
2015-12-17 18:34:10 +00:00
|
|
|
var Promise = require('bluebird');
|
2015-07-01 11:43:25 +00:00
|
|
|
|
|
|
|
function createPromiseCallback() {
|
|
|
|
var cb;
|
2015-12-17 18:34:10 +00:00
|
|
|
var promise = new Promise(function(resolve, reject) {
|
2015-07-01 11:43:25 +00:00
|
|
|
cb = function(err, data) {
|
|
|
|
if (err) return reject(err);
|
|
|
|
return resolve(data);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
cb.promise = promise;
|
|
|
|
return cb;
|
|
|
|
}
|