Remove addListener/removeListener

This commit is contained in:
Daniel Imms
2016-12-31 07:10:45 -08:00
parent 937cf43e09
commit 0d9d3aca1a
2 changed files with 8 additions and 18 deletions
+2 -12
View File
@@ -14,18 +14,12 @@ export class EventEmitter {
this._events = {};
}
// TODO: Merge addListener and on, no reason for an alias in a private component
public addListener(type, listener): void {
public on(type, listener): void {
this._events[type] = this._events[type] || [];
this._events[type].push(listener);
}
public on(type, listener): void {
this.addListener(type, listener);
}
// TODO: Merge removeListener and off, no reason for an alias in a private component
public removeListener(type, listener): void {
public off(type, listener): void {
if (!this._events[type]) {
return;
}
@@ -41,10 +35,6 @@ export class EventEmitter {
}
}
public off(type, listener): void {
this.removeListener(type, listener);
}
public removeAllListeners(type): void {
if (this._events[type]) {
delete this._events[type];