ev: Cannot read property 'push' of undefined

This commit is contained in:
thecodrr
2020-04-16 03:31:34 +05:00
parent bfb40a5cf1
commit 1cf051d351

View File

@@ -5,7 +5,7 @@ class EventManager {
subscribe(name, handler) { subscribe(name, handler) {
if (!name || !handler) throw new Error("name and handler are required."); if (!name || !handler) throw new Error("name and handler are required.");
if (!this._registry[name]) this._registry.name = []; if (!this._registry[name]) this._registry[name] = [];
this._registry[name].push(handler); this._registry[name].push(handler);
} }