Kaynağa Gözat

feat(keyboard-shortcuts): fix removing shortcuts (#2749)

master
Saúl Ibarra Corretgé 7 yıl önce
ebeveyn
işleme
95e00405b6
1 değiştirilmiş dosya ile 9 ekleme ve 9 silme
  1. 9
    9
      modules/keyboardshortcut/keyboardshortcut.js

+ 9
- 9
modules/keyboardshortcut/keyboardshortcut.js Dosyayı Görüntüle

@@ -15,9 +15,9 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
15 15
 
16 16
 /**
17 17
  * Map of shortcuts. When a shortcut is registered it enters the mapping.
18
- * @type {{}}
18
+ * @type {Map}
19 19
  */
20
-const _shortcuts = {};
20
+const _shortcuts = new Map();
21 21
 
22 22
 /**
23 23
  * Map of registered keyboard keys and translation keys describing the
@@ -49,8 +49,8 @@ const KeyboardShortcut = {
49 49
             if (!($(':focus').is('input[type=text]')
50 50
                 || $(':focus').is('input[type=password]')
51 51
                 || $(':focus').is('textarea'))) {
52
-                if (_shortcuts.hasOwnProperty(key)) {
53
-                    _shortcuts[key].function(e);
52
+                if (_shortcuts.has(key)) {
53
+                    _shortcuts.get(key).function(e);
54 54
                 } else if (!isNaN(num) && num >= 0 && num <= 9) {
55 55
                     APP.UI.clickOnVideo(num);
56 56
                 }
@@ -117,11 +117,11 @@ const KeyboardShortcut = {
117 117
             shortcutAttr,
118 118
             exec,
119 119
             helpDescription) {
120
-        _shortcuts[shortcutChar] = {
120
+        _shortcuts.set(shortcutChar, {
121 121
             character: shortcutChar,
122
-            shortcutAttr,
123
-            function: exec
124
-        };
122
+            function: exec,
123
+            shortcutAttr
124
+        });
125 125
 
126 126
         if (helpDescription) {
127 127
             this._addShortcutToHelp(shortcutChar, helpDescription);
@@ -135,7 +135,7 @@ const KeyboardShortcut = {
135 135
      * no longer be usable
136 136
      */
137 137
     unregisterShortcut(shortcutChar) {
138
-        _shortcuts.remove(shortcutChar);
138
+        _shortcuts.delete(shortcutChar);
139 139
         _shortcutsHelp.delete(shortcutChar);
140 140
     },
141 141
 

Loading…
İptal
Kaydet