add check for eventListenerCount
This commit is contained in:
@@ -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
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user