Permalink
Browse files

fix(AttributeNode): Fixed an issue that added multiple event listener…

…s to a node
  • Loading branch information...
calebdwilliams committed Jul 26, 2018
1 parent b211752 commit da6f8c9039f96f6168ca05682129fab6d34fafe6
@@ -55,9 +55,11 @@ class AttributeNode {
}

addListener(eventName, method) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
if (!this.eventMap.get(eventName)) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
}
}

addListeners() {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -51,9 +51,11 @@ class AttributeNode {
}

addListener(eventName, method) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
if (!this.eventMap.get(eventName)) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
}
}

addListeners() {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -54,9 +54,11 @@ class AttributeNode {
}

addListener(eventName, method) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
if (!this.eventMap.get(eventName)) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
}
}

addListeners() {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -57,9 +57,11 @@ class AttributeNode {
}

addListener(eventName, method) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
if (!this.eventMap.get(eventName)) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
}
}

addListeners() {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -18,9 +18,11 @@ export class AttributeNode {
}

addListener(eventName, method) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
if (!this.eventMap.get(eventName)) {
this.node.addEventListener(eventName, method.bind(this.context));
this.eventMap.set(eventName, method);
!this.context.DEBUG ? this.node.removeAttribute(`(${eventName})`) : null;
}
}

addListeners() {

0 comments on commit da6f8c9

Please sign in to comment.