History

class Events

Simon Legner committed 2 years ago

Commit a725a0a1 parent 48554741 file · +6 −6Browse files

Unified · Split

assets/javascripts/lib/events.js+6−6
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * DS208: Avoid top-level this
1010 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
1111 */
12−this.Events = {
12+class Events {
1313 on(event, callback) {
1414 if (event.indexOf(" ") >= 0) {
1515 for (var name of Array.from(event.split(" "))) {
@@ -26,7 +26,7 @@ this.Events = { · 10 unmodified lines
2626 ).push(callback);
2727 }
2828 return this;
29− },
29+ }
3030
3131 off(event, callback) {
3232 let callbacks, index;
@@ -45,7 +45,7 @@ this.Events = { · 12 unmodified lines
4545 }
4646 }
4747 return this;
48− },
48+ }
4949
5050 trigger(event, ...args) {
5151 let callbacks;
@@ -64,7 +64,7 @@ this.Events = { · 12 unmodified lines
6464 this.trigger("all", event, ...Array.from(args));
6565 }
6666 return this;
67− },
67+ }
6868
6969 removeEvent(event) {
7070 if (this._callbacks != null) {
@@ -73,5 +73,5 @@ this.Events = { · 2 unmodified lines
7373 }
7474 }
7575 return this;
76− },
77−};
76+ }
77+}