Add missing EventEmitter.emit args/types

This commit is contained in:
Daniel Imms
2017-05-21 11:25:18 -07:00
parent a95ac990ff
commit ea008411e4
+1 -4
View File
@@ -53,14 +53,11 @@ export class EventEmitter {
return this.on(type, on); return this.on(type, on);
} }
public emit(type): void { public emit(type: string, ...args: any[]): void {
if (!this._events[type]) { if (!this._events[type]) {
return; return;
} }
let args = Array.prototype.slice.call(arguments, 1);
let obj = this._events[type]; let obj = this._events[type];
for (let i = 0; i < obj.length; i++) { for (let i = 0; i < obj.length; i++) {
obj[i].apply(this, args); obj[i].apply(this, args);
} }