mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add check for eventListenerCount
This commit is contained in:
parent
5104aabead
commit
4c3af5b9dd
1 changed files with 3 additions and 3 deletions
|
@ -22,12 +22,12 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playba
|
||||||
|
|
||||||
var eventListenerCount = 0;
|
var eventListenerCount = 0;
|
||||||
function on(scope, fn) {
|
function on(scope, fn) {
|
||||||
eventListenerCount++;
|
if (eventListenerCount) eventListenerCount++;
|
||||||
dom.addEventListener(scope, 'command', fn, {});
|
dom.addEventListener(scope, 'command', fn, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function off(scope, fn) {
|
function off(scope, fn) {
|
||||||
eventListenerCount--;
|
if (eventListenerCount) eventListenerCount--;
|
||||||
dom.removeEventListener(scope, 'command', fn, {});
|
dom.removeEventListener(scope, 'command', fn, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,4 +234,4 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playba
|
||||||
on: on,
|
on: on,
|
||||||
off: off
|
off: off
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue