diff --git a/src/components/emit-state-change.js b/src/components/emit-state-change.js index b3357cd3911f26b8165235ca06e32e64d8bf0ac0..c436293d703cfda73c2b3f14102b8abfcdbd8fad 100644 --- a/src/components/emit-state-change.js +++ b/src/components/emit-state-change.js @@ -23,11 +23,14 @@ AFRAME.registerComponent("emit-state-change", { }, update() { + this.el.removeEventListener("stateadded", this.stateadded); + this.el.removeEventListener("stateremoved", this.stateremoved); + if (this.data.transform === "rising") { this.el.addEventListener("stateadded", this.stateadded); } if (this.data.transform === "falling") { - this.el.addEventListener("stateremoved", this.stateadded); + this.el.addEventListener("stateremoved", this.stateremoved); } } });