From 4f937f077d8b61da46953647136a882671e8e1ee Mon Sep 17 00:00:00 2001 From: Dahan Gong Date: Fri, 13 Jan 2017 19:02:49 +0800 Subject: [PATCH 1/3] Remove typos A message from `git stash` blocked the building process. --- src/autoStart/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/autoStart/index.js b/src/autoStart/index.js index 312a54a9a..69605d77f 100644 --- a/src/autoStart/index.js +++ b/src/autoStart/index.js @@ -186,7 +186,6 @@ Interaction.signals.on('stop', function ({ interaction }) { } }); -<<<<<<< Updated upstream Interactable.prototype.getAction = function (pointer, event, interaction, element) { const action = this.defaultActionChecker(pointer, event, interaction, element); @@ -293,8 +292,6 @@ Interactable.prototype.defaultActionChecker = function (pointer, event, interact } }; -======= ->>>>>>> Stashed changes function withinInteractionLimit (interactable, element, action) { const options = interactable.options; const maxActions = options[action.name].max; From 2f168c71656933d1841d515c31c89a759e50d060 Mon Sep 17 00:00:00 2001 From: Dahan Gong Date: Fri, 13 Jan 2017 19:09:46 +0800 Subject: [PATCH 2/3] fix a typo in Interactable.off It should have called `this.events.off` --- src/Interactable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interactable.js b/src/Interactable.js index a1a1cb625..0f83e5daa 100644 --- a/src/Interactable.js +++ b/src/Interactable.js @@ -299,7 +299,7 @@ class Interactable { // if it is an action event type if (contains(Interactable.eventTypes, eventType)) { - this.events.on(eventType, listener); + this.events.off(eventType, listener); } // delegated event else if (isType.isString(this.target)) { From 9f0ae6d3aa5c6dfedc5807fa8aa976dde8cf5473 Mon Sep 17 00:00:00 2001 From: Dahan Gong Date: Fri, 13 Jan 2017 19:23:37 +0800 Subject: [PATCH 3/3] allow Eventable.off to remove a group of listeners It may do this when the argument `listener` is `undefined`. --- src/Eventable.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Eventable.js b/src/Eventable.js index cb3433f4d..a7976b954 100644 --- a/src/Eventable.js +++ b/src/Eventable.js @@ -36,11 +36,11 @@ class Eventable { on (eventType, listener) { // if this type of event was never bound - if (!(eventType in this)) { - this[eventType] = [listener]; + if (this[eventType]) { + this[eventType].push(listener); } else { - this[eventType].push(listener); + this[eventType] = [listener]; } } @@ -50,7 +50,11 @@ class Eventable { const index = eventList? indexOf(eventList, listener) : -1; if (index !== -1) { - this[eventType].splice(index, 1); + eventList.splice(index, 1); + } + let undef; + if (eventList && eventList.length === 0 || undef === listener) { + this[eventType] = undef; } } }