Web Dev Solutions

Catalin Mititiuc

From 98e4fd58d8c222652f3a5bd1d8a76f7618824e17 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Wed, 22 May 2024 09:12:47 -0700 Subject: Use observable for end move and prone flag --- src/modules/observable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/observable.js') diff --git a/src/modules/observable.js b/src/modules/observable.js index e4f6797..c9bea9b 100644 --- a/src/modules/observable.js +++ b/src/modules/observable.js @@ -2,7 +2,7 @@ const observers = {}; export const Observable = Object.freeze({ notify: (event, data) => { - observers[event].forEach((observer) => observer(data)) + (observers[event] || []).forEach((observer) => observer(data)) }, subscribe: (event, func) => { -- cgit v1.2.3