From a725a0aabbd0b9bbd50af0afdfdb7f2a04800d67 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sat, 6 Jan 2024 12:14:49 +0100 Subject: [PATCH] class Events --- assets/javascripts/lib/events.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/javascripts/lib/events.js b/assets/javascripts/lib/events.js index 5c23f8ce..75c2b9b0 100644 --- a/assets/javascripts/lib/events.js +++ b/assets/javascripts/lib/events.js @@ -9,7 +9,7 @@ * DS208: Avoid top-level this * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ -this.Events = { +class Events { on(event, callback) { if (event.indexOf(" ") >= 0) { for (var name of Array.from(event.split(" "))) { @@ -26,7 +26,7 @@ this.Events = { ).push(callback); } return this; - }, + } off(event, callback) { let callbacks, index; @@ -45,7 +45,7 @@ this.Events = { } } return this; - }, + } trigger(event, ...args) { let callbacks; @@ -64,7 +64,7 @@ this.Events = { this.trigger("all", event, ...Array.from(args)); } return this; - }, + } removeEvent(event) { if (this._callbacks != null) { @@ -73,5 +73,5 @@ this.Events = { } } return this; - }, -}; + } +}