From 4c3af5b9dde98689d731bc494714079f9e4bbe8e Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 24 Sep 2019 23:23:43 +0900 Subject: [PATCH] add check for eventListenerCount --- src/components/inputManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/inputManager.js b/src/components/inputManager.js index 5261cf13b3..6190470fb5 100644 --- a/src/components/inputManager.js +++ b/src/components/inputManager.js @@ -22,12 +22,12 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playba var eventListenerCount = 0; function on(scope, fn) { - eventListenerCount++; + if (eventListenerCount) eventListenerCount++; dom.addEventListener(scope, 'command', fn, {}); } function off(scope, fn) { - eventListenerCount--; + if (eventListenerCount) eventListenerCount--; dom.removeEventListener(scope, 'command', fn, {}); } @@ -234,4 +234,4 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playba on: on, off: off }; -}); \ No newline at end of file +});