Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced several Array.prototype.slice.call() calls with Array.protot…

…ype.unshift.call()

Acts in pretty much the same manor just a bit more elegant
  • Loading branch information...
commit f3b0cefd0b1916c7f3ba0ca04560614bb6de9122 1 parent 7873639
@tj tj authored ry committed
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/node.js
View
15 src/node.js
@@ -248,25 +248,22 @@ process.Promise.prototype.cancel = function() {
};
process.Promise.prototype.emitCancel = function() {
- var args = Array.prototype.slice.call(arguments);
- args.unshift('cancel');
- this.emit.apply(this, args);
+ Array.prototype.unshift.call(arguments, 'cancel')
+ this.emit.apply(this, arguments);
};
process.Promise.prototype.emitSuccess = function() {
if (this.hasFired) return;
- var args = Array.prototype.slice.call(arguments);
- args.unshift('success');
this.hasFired = true;
- this.emit.apply(this, args);
+ Array.prototype.unshift.call(arguments, 'success')
+ this.emit.apply(this, arguments);
};
process.Promise.prototype.emitError = function() {
if (this.hasFired) return;
- var args = Array.prototype.slice.call(arguments);
- args.unshift('error');
this.hasFired = true;
- this.emit.apply(this, args);
+ Array.prototype.unshift.call(arguments, 'error')
+ this.emit.apply(this, arguments);
};
process.Promise.prototype.addCallback = function (listener) {
Please sign in to comment.
Something went wrong with that request. Please try again.