remove checking current hooks for event handling (#824)

This commit is contained in:
jberg 2019-08-01 19:47:06 -07:00 committed by Jordan Eldredge
parent 769c7b9577
commit 3559953440
3 changed files with 3 additions and 20 deletions

View file

@ -133,15 +133,10 @@ function Button({ id, image, action, x, y, downImage, tooltip, node, children })
return null;
}
const hooks = node.js_getActiveHooks();
const eventHandlers = {};
if (hooks.includes("onLeftClick")) {
eventHandlers["onClick"] = e => {
if (hooks.includes("onLeftClick")) {
node.js_trigger("onLeftClick");
}
};
}
eventHandlers["onClick"] = e => {
node.js_trigger("onLeftClick");
};
return (
<div

View file

@ -21,7 +21,6 @@ class Variable {
this._unsubscribeFromValue = value.js_listenToAll((eventName, args) => {
this._emitter.trigger(eventName, args);
});
value.js_updateHooks(this, Object.keys(this._emitter._hooks));
}
this._value = value;
}

View file

@ -5,7 +5,6 @@ class MakiObject {
this.xmlNode = node;
this.parent = parent;
this.children = [];
this.hooks = {};
this._emitter = new Emitter();
if (!this.xmlNode) {
@ -43,16 +42,6 @@ class MakiObject {
this._emitter.dispose();
}
// updating hooks like this is probably totally wrong, but just hacking for now
js_updateHooks (node, hooks) {
this.hooks[node] = hooks;
}
js_getActiveHooks () {
const hookArrs = Object.values(this.hooks);
return hookArrs.reduce((acc, val) => acc.concat(val), []);
}
/**
* getClassName()
*