aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authornskazki <nskazki@gmail.com>2019-07-19 16:12:16 +0300
committernskazki <nskazki@gmail.com>2019-07-19 16:26:01 +0300
commitb36b92b2478b5aac165be0d3d84cd1f011d4c8df (patch)
tree715d594088ddcc7085800214096c1a381aedf858 /src/js
parentdfc09b8e04f6e4829c29a68106eb4af5be76a2ff (diff)
downloadplyr-b36b92b2478b5aac165be0d3d84cd1f011d4c8df.tar.lz
plyr-b36b92b2478b5aac165be0d3d84cd1f011d4c8df.tar.xz
plyr-b36b92b2478b5aac165be0d3d84cd1f011d4c8df.zip
Detach event listeners on destroy
if "on" receives "this", it attaches "eventListeners" array to "this" and stores "{ element, type, callback }" hash in there. later, during the destruction process, all the entries from this array will be processed by "unbindListeners" helper to detach all the event listeners.
Diffstat (limited to 'src/js')
-rw-r--r--src/js/controls.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index 7afcd2c0..b5b2d00a 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -402,7 +402,8 @@ const controls = {
// https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
bindMenuItemShortcuts(menuItem, type) {
// Navigate through menus via arrow keys and space
- on(
+ on.call(
+ this,
menuItem,
'keydown keyup',
event => {
@@ -452,7 +453,7 @@ const controls = {
// Enter will fire a `click` event but we still need to manage focus
// So we bind to keyup which fires after and set focus here
- on(menuItem, 'keyup', event => {
+ on.call(this, menuItem, 'keyup', event => {
if (event.which !== 13) {
return;
}
@@ -1463,7 +1464,7 @@ const controls = {
bindMenuItemShortcuts.call(this, menuItem, type);
// Show menu on click
- on(menuItem, 'click', () => {
+ on.call(this, menuItem, 'click', () => {
showMenuPanel.call(this, type, false);
});
@@ -1515,7 +1516,8 @@ const controls = {
);
// Go back via keyboard
- on(
+ on.call(
+ this,
pane,
'keydown',
event => {
@@ -1535,7 +1537,7 @@ const controls = {
);
// Go back via button click
- on(backButton, 'click', () => {
+ on.call(this, backButton, 'click', () => {
showMenuPanel.call(this, 'home', false);
});