class Events

pull/1441/head
Simon Legner 1 year ago
parent 4855474672
commit a725a0aabb

@ -9,7 +9,7 @@
* DS208: Avoid top-level this * DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/ */
this.Events = { class Events {
on(event, callback) { on(event, callback) {
if (event.indexOf(" ") >= 0) { if (event.indexOf(" ") >= 0) {
for (var name of Array.from(event.split(" "))) { for (var name of Array.from(event.split(" "))) {
@ -26,7 +26,7 @@ this.Events = {
).push(callback); ).push(callback);
} }
return this; return this;
}, }
off(event, callback) { off(event, callback) {
let callbacks, index; let callbacks, index;
@ -45,7 +45,7 @@ this.Events = {
} }
} }
return this; return this;
}, }
trigger(event, ...args) { trigger(event, ...args) {
let callbacks; let callbacks;
@ -64,7 +64,7 @@ this.Events = {
this.trigger("all", event, ...Array.from(args)); this.trigger("all", event, ...Array.from(args));
} }
return this; return this;
}, }
removeEvent(event) { removeEvent(event) {
if (this._callbacks != null) { if (this._callbacks != null) {
@ -73,5 +73,5 @@ this.Events = {
} }
} }
return this; return this;
}, }
}; }

Loading…
Cancel
Save