不要怂,就是干,撸起袖子干!

Commit 24b23626 by Mick Hansen

feat(promises): when calling then/spread from custom event emitter make sure to …

…proxy sql events on to the new promise
1 parent db5e3d87
Showing with 10 additions and 4 deletions
......@@ -233,10 +233,13 @@ module.exports = (function() {
onFulfilled = bindToProcess(onFulfilled)
onRejected = bindToProcess(onRejected)
return new Promise(function (resolve, reject) {
var promise = (new Promise(function (resolve, reject) {
self.on('error', reject)
.on('success', resolve)
}).then(onFulfilled, onRejected)
})).then(onFulfilled, onRejected)
this.proxySql(promise);
return promise;
}
/**
......@@ -252,12 +255,15 @@ module.exports = (function() {
onFulfilled = bindToProcess(onFulfilled)
onRejected = bindToProcess(onRejected)
return new Promise(function (resolve, reject) {
var promise = (new Promise(function (resolve, reject) {
self.on('error', reject)
.on('success', function () {
resolve(Array.prototype.slice.apply(arguments)) // Transform args to an array
})
}).spread(onFulfilled, onRejected)
})).spread(onFulfilled, onRejected)
this.proxySql(promise);
return promise;
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!