From 95e00405b670ffc05024a54b7a3541dad27c0fab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= <s@saghul.net>
Date: Fri, 6 Apr 2018 17:11:21 +0200
Subject: [PATCH] feat(keyboard-shortcuts): fix removing shortcuts (#2749)

---
 modules/keyboardshortcut/keyboardshortcut.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js
index 5d5f556da..d10b6745f 100644
--- a/modules/keyboardshortcut/keyboardshortcut.js
+++ b/modules/keyboardshortcut/keyboardshortcut.js
@@ -15,9 +15,9 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
 
 /**
  * Map of shortcuts. When a shortcut is registered it enters the mapping.
- * @type {{}}
+ * @type {Map}
  */
-const _shortcuts = {};
+const _shortcuts = new Map();
 
 /**
  * Map of registered keyboard keys and translation keys describing the
@@ -49,8 +49,8 @@ const KeyboardShortcut = {
             if (!($(':focus').is('input[type=text]')
                 || $(':focus').is('input[type=password]')
                 || $(':focus').is('textarea'))) {
-                if (_shortcuts.hasOwnProperty(key)) {
-                    _shortcuts[key].function(e);
+                if (_shortcuts.has(key)) {
+                    _shortcuts.get(key).function(e);
                 } else if (!isNaN(num) && num >= 0 && num <= 9) {
                     APP.UI.clickOnVideo(num);
                 }
@@ -117,11 +117,11 @@ const KeyboardShortcut = {
             shortcutAttr,
             exec,
             helpDescription) {
-        _shortcuts[shortcutChar] = {
+        _shortcuts.set(shortcutChar, {
             character: shortcutChar,
-            shortcutAttr,
-            function: exec
-        };
+            function: exec,
+            shortcutAttr
+        });
 
         if (helpDescription) {
             this._addShortcutToHelp(shortcutChar, helpDescription);
@@ -135,7 +135,7 @@ const KeyboardShortcut = {
      * no longer be usable
      */
     unregisterShortcut(shortcutChar) {
-        _shortcuts.remove(shortcutChar);
+        _shortcuts.delete(shortcutChar);
         _shortcutsHelp.delete(shortcutChar);
     },