mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Micro JS optimizations
This commit is contained in:
parent
00679880bd
commit
0dd0e64485
@ -362,7 +362,7 @@ AsyncWriter.prototype = {
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
this.emit('beginAsync', {
|
||||
this._events.emit('beginAsync', {
|
||||
writer: this,
|
||||
parentWriter: parent
|
||||
});
|
||||
@ -397,9 +397,20 @@ AsyncWriter.prototype = {
|
||||
lastArray.push(callback);
|
||||
},
|
||||
|
||||
emit: function() {
|
||||
emit: function(arg) {
|
||||
var events = this._events;
|
||||
events.emit.apply(events, arguments);
|
||||
switch(arguments.length) {
|
||||
case 0:
|
||||
events.emit();
|
||||
break;
|
||||
case 1:
|
||||
events.emit(arg);
|
||||
break;
|
||||
default:
|
||||
events.emit.apply(events, arguments);
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
@ -466,7 +477,7 @@ AsyncWriter.prototype = {
|
||||
if (!async.lastFired && async.remaining - async.last === 0) {
|
||||
async.lastFired = true;
|
||||
async.last = 0;
|
||||
this.emit('last');
|
||||
this._events.emit('last');
|
||||
}
|
||||
|
||||
if (remaining === 0) {
|
||||
@ -480,7 +491,7 @@ AsyncWriter.prototype = {
|
||||
if (this._stream.end) {
|
||||
this._stream.end();
|
||||
} else {
|
||||
this.emit('finish');
|
||||
this._events.emit('finish');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user