@yhwh-script/event-bux 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8,10 +8,10 @@ export const addEventListener = function (type, listener, context = undefined) {
|
|
|
8
8
|
listeners.set(context, new Map()); // will be stored here
|
|
9
9
|
}
|
|
10
10
|
const contextListeners = listeners.get(context);
|
|
11
|
-
if (!contextListeners.has(type)) { //
|
|
11
|
+
if (!contextListeners.has(type)) { // type is not yet registered
|
|
12
12
|
contextListeners.set(type, []);
|
|
13
13
|
} // next push the handler to the WeakMap for the given context
|
|
14
|
-
contextListeners.get(
|
|
14
|
+
contextListeners.get(type).push(listener);
|
|
15
15
|
} else { // default
|
|
16
16
|
if (context) { // illegal context
|
|
17
17
|
throw new Error("Syntax error.")
|
package/package.json
CHANGED