Unified · Split
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | * DS208: Avoid top-level this | 9 | * DS208: Avoid top-level this |
| 10 | * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md | 10 | * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md |
| 11 | */ | 11 | */ |
| 12 | this.Events = { | 12 | class Events { |
| 13 | on(event, callback) { | 13 | on(event, callback) { |
| 14 | if (event.indexOf(" ") >= 0) { | 14 | if (event.indexOf(" ") >= 0) { |
| 15 | for (var name of Array.from(event.split(" "))) { | 15 | for (var name of Array.from(event.split(" "))) { |
| @@ -26,7 +26,7 @@ this.Events = { · 10 unmodified lines | |||
| 26 | ).push(callback); | 26 | ).push(callback); |
| 27 | } | 27 | } |
| 28 | return this; | 28 | return this; |
| 29 | }, | 29 | } |
| 30 | 30 | ||
| 31 | off(event, callback) { | 31 | off(event, callback) { |
| 32 | let callbacks, index; | 32 | let callbacks, index; |
| @@ -45,7 +45,7 @@ this.Events = { · 12 unmodified lines | |||
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| 47 | return this; | 47 | return this; |
| 48 | }, | 48 | } |
| 49 | 49 | ||
| 50 | trigger(event, ...args) { | 50 | trigger(event, ...args) { |
| 51 | let callbacks; | 51 | let callbacks; |
| @@ -64,7 +64,7 @@ this.Events = { · 12 unmodified lines | |||
| 64 | this.trigger("all", event, ...Array.from(args)); | 64 | this.trigger("all", event, ...Array.from(args)); |
| 65 | } | 65 | } |
| 66 | return this; | 66 | return this; |
| 67 | }, | 67 | } |
| 68 | 68 | ||
| 69 | removeEvent(event) { | 69 | removeEvent(event) { |
| 70 | if (this._callbacks != null) { | 70 | if (this._callbacks != null) { |
| @@ -73,5 +73,5 @@ this.Events = { · 2 unmodified lines | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | return this; | 75 | return this; |
| 76 | }, | 76 | } |
| 77 | }; | 77 | } |