about summary refs log tree commit diff stats
path: root/html/rogue/js/events.js
diff options
context:
space:
mode:
authorelioat <{ID}+{username}@users.noreply.github.com>2024-12-27 10:54:27 -0500
committerelioat <{ID}+{username}@users.noreply.github.com>2024-12-27 10:54:27 -0500
commitd17d85553a72e40ac390238dab5c03dfa9f567ee (patch)
tree896e1be92e1fe21b17d6a30cd1c0dfb5375e6224 /html/rogue/js/events.js
parent93af36423b2a1415c89ab7adb92ee458d4ae5a46 (diff)
downloadtour-d17d85553a72e40ac390238dab5c03dfa9f567ee.tar.gz
*
Diffstat (limited to 'html/rogue/js/events.js')
-rw-r--r--html/rogue/js/events.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/html/rogue/js/events.js b/html/rogue/js/events.js
new file mode 100644
index 0000000..9ae8241
--- /dev/null
+++ b/html/rogue/js/events.js
@@ -0,0 +1,16 @@
+const EventSystem = {
+    listeners: new Map(),
+    
+    on(event, callback) {
+        if (!this.listeners.has(event)) {
+            this.listeners.set(event, new Set());
+        }
+        this.listeners.get(event).add(callback);
+    },
+    
+    emit(event, data) {
+        if (this.listeners.has(event)) {
+            this.listeners.get(event).forEach(callback => callback(data));
+        }
+    }
+}; 
\ No newline at end of file