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

Commit 5a75d260 by Jan Aagaard Meier

Refactored model.update and destroy to use promises

1 parent 1bd525d2
Showing with 6 additions and 2 deletions
...@@ -92,7 +92,9 @@ Hooks.runHooks = function() { ...@@ -92,7 +92,9 @@ Hooks.runHooks = function() {
if (!!arguments[0]) { if (!!arguments[0]) {
return reject(arguments[0]) return reject(arguments[0])
} }
resolveArgs = Array.prototype.slice.call(arguments, 1) if (arguments.length) {
resolveArgs = Array.prototype.slice.call(arguments, 1)
}
return run(hooks[tick]) return run(hooks[tick])
})) }))
...@@ -101,7 +103,9 @@ Hooks.runHooks = function() { ...@@ -101,7 +103,9 @@ Hooks.runHooks = function() {
maybePromise.spread(function () { maybePromise.spread(function () {
tick++ tick++
resolveArgs = Array.prototype.slice.call(arguments) if (arguments.length) {
resolveArgs = Array.prototype.slice.call(arguments)
}
return run(hooks[tick]) return run(hooks[tick])
}, reject) }, reject)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!