Browse Source

Fix CallStats require and initialize API commands and keyboard shortcuts in init method

master
Devin Wilson 10 years ago
parent
commit
829d8dab16
3 changed files with 98 additions and 113 deletions
  1. 52
    76
      libs/app.bundle.js
  2. 14
    9
      modules/API/API.js
  3. 32
    28
      modules/keyboardshortcut/keyboardshortcut.js

+ 52
- 76
libs/app.bundle.js View File

@@ -73,15 +73,19 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
73 73
  *              filmStrip: toggleFilmStrip
74 74
  *          }}
75 75
  */
76
-var commands =
77
-{
78
-    displayName: APP.UI.inputDisplayNameHandler,
79
-    muteAudio: APP.UI.toggleAudio,
80
-    muteVideo: APP.UI.toggleVideo,
81
-    toggleFilmStrip: APP.UI.toggleFilmStrip,
82
-    toggleChat: APP.UI.toggleChat,
83
-    toggleContactList: APP.UI.toggleContactList
84
-};
76
+var commands = {};
77
+
78
+function initCommands() {
79
+    commands =
80
+    {
81
+        displayName: APP.UI.inputDisplayNameHandler,
82
+        muteAudio: APP.UI.toggleAudio,
83
+        muteVideo: APP.UI.toggleVideo,
84
+        toggleFilmStrip: APP.UI.toggleFilmStrip,
85
+        toggleChat: APP.UI.toggleChat,
86
+        toggleContactList: APP.UI.toggleContactList
87
+    };
88
+}
85 89
 
86 90
 
87 91
 /**
@@ -234,6 +238,7 @@ var API = {
234 238
      * is initialized.
235 239
      */
236 240
     init: function () {
241
+        initCommands();
237 242
         if (window.addEventListener)
238 243
         {
239 244
             window.addEventListener('message',
@@ -11503,40 +11508,44 @@ module.exports = {
11503 11508
 
11504 11509
 },{"../../service/RTC/RTCEvents":99,"../../service/desktopsharing/DesktopSharingEventTypes":105,"../RTC/RTCBrowserType":8,"../RTC/adapter.screenshare":10,"events":109}],45:[function(require,module,exports){
11505 11510
 //maps keycode to character, id of popover for given function and function
11506
-var shortcuts = {
11507
-    67: {
11508
-        character: "C",
11509
-        id: "toggleChatPopover",
11510
-        function: APP.UI.toggleChat
11511
-    },
11512
-    70: {
11513
-        character: "F",
11514
-        id: "filmstripPopover",
11515
-        function: APP.UI.toggleFilmStrip
11516
-    },
11517
-    77: {
11518
-        character: "M",
11519
-        id: "mutePopover",
11520
-        function: APP.UI.toggleAudio
11521
-    },
11522
-    84: {
11523
-        character: "T",
11524
-        function: function() {
11525
-            if(!APP.RTC.localAudio.isMuted()) {
11526
-                APP.UI.toggleAudio();
11511
+var shortcuts = {};
11512
+function initShortcutHandlers() {
11513
+    shortcuts = {
11514
+        67: {
11515
+            character: "C",
11516
+            id: "toggleChatPopover",
11517
+            function: APP.UI.toggleChat
11518
+        },
11519
+        70: {
11520
+            character: "F",
11521
+            id: "filmstripPopover",
11522
+            function: APP.UI.toggleFilmStrip
11523
+        },
11524
+        77: {
11525
+            character: "M",
11526
+            id: "mutePopover",
11527
+            function: APP.UI.toggleAudio
11528
+        },
11529
+        84: {
11530
+            character: "T",
11531
+            function: function() {
11532
+                if(!APP.RTC.localAudio.isMuted()) {
11533
+                    APP.UI.toggleAudio();
11534
+                }
11527 11535
             }
11536
+        },
11537
+        86: {
11538
+            character: "V",
11539
+            id: "toggleVideoPopover",
11540
+            function: APP.UI.toggleVideo
11528 11541
         }
11529
-    },
11530
-    86: {
11531
-        character: "V",
11532
-        id: "toggleVideoPopover",
11533
-        function: APP.UI.toggleVideo
11534
-    }
11535
-};
11542
+    };
11543
+}
11536 11544
 
11537 11545
 
11538 11546
 var KeyboardShortcut = {
11539 11547
     init: function () {
11548
+        initShortcutHandlers();
11540 11549
         window.onkeyup = function(e) {
11541 11550
             var keycode = e.which;
11542 11551
             if(!($(":focus").is("input[type=text]") ||
@@ -30348,70 +30357,37 @@ function isUndefined(arg) {
30348 30357
 var process = module.exports = {};
30349 30358
 var queue = [];
30350 30359
 var draining = false;
30351
-var currentQueue;
30352
-var queueIndex = -1;
30353
-
30354
-function cleanUpNextTick() {
30355
-    draining = false;
30356
-    if (currentQueue.length) {
30357
-        queue = currentQueue.concat(queue);
30358
-    } else {
30359
-        queueIndex = -1;
30360
-    }
30361
-    if (queue.length) {
30362
-        drainQueue();
30363
-    }
30364
-}
30365 30360
 
30366 30361
 function drainQueue() {
30367 30362
     if (draining) {
30368 30363
         return;
30369 30364
     }
30370
-    var timeout = setTimeout(cleanUpNextTick);
30371 30365
     draining = true;
30372
-
30366
+    var currentQueue;
30373 30367
     var len = queue.length;
30374 30368
     while(len) {
30375 30369
         currentQueue = queue;
30376 30370
         queue = [];
30377
-        while (++queueIndex < len) {
30378
-            currentQueue[queueIndex].run();
30371
+        var i = -1;
30372
+        while (++i < len) {
30373
+            currentQueue[i]();
30379 30374
         }
30380
-        queueIndex = -1;
30381 30375
         len = queue.length;
30382 30376
     }
30383
-    currentQueue = null;
30384 30377
     draining = false;
30385
-    clearTimeout(timeout);
30386 30378
 }
30387
-
30388 30379
 process.nextTick = function (fun) {
30389
-    var args = new Array(arguments.length - 1);
30390
-    if (arguments.length > 1) {
30391
-        for (var i = 1; i < arguments.length; i++) {
30392
-            args[i - 1] = arguments[i];
30393
-        }
30394
-    }
30395
-    queue.push(new Item(fun, args));
30396
-    if (queue.length === 1 && !draining) {
30380
+    queue.push(fun);
30381
+    if (!draining) {
30397 30382
         setTimeout(drainQueue, 0);
30398 30383
     }
30399 30384
 };
30400 30385
 
30401
-// v8 likes predictible objects
30402
-function Item(fun, array) {
30403
-    this.fun = fun;
30404
-    this.array = array;
30405
-}
30406
-Item.prototype.run = function () {
30407
-    this.fun.apply(null, this.array);
30408
-};
30409 30386
 process.title = 'browser';
30410 30387
 process.browser = true;
30411 30388
 process.env = {};
30412 30389
 process.argv = [];
30413 30390
 process.version = ''; // empty string to avoid regexp issues
30414
-process.versions = {};
30415 30391
 
30416 30392
 function noop() {}
30417 30393
 

+ 14
- 9
modules/API/API.js View File

@@ -15,15 +15,19 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
15 15
  *              filmStrip: toggleFilmStrip
16 16
  *          }}
17 17
  */
18
-var commands =
19
-{
20
-    displayName: APP.UI.inputDisplayNameHandler,
21
-    muteAudio: APP.UI.toggleAudio,
22
-    muteVideo: APP.UI.toggleVideo,
23
-    toggleFilmStrip: APP.UI.toggleFilmStrip,
24
-    toggleChat: APP.UI.toggleChat,
25
-    toggleContactList: APP.UI.toggleContactList
26
-};
18
+var commands = {};
19
+
20
+function initCommands() {
21
+    commands =
22
+    {
23
+        displayName: APP.UI.inputDisplayNameHandler,
24
+        muteAudio: APP.UI.toggleAudio,
25
+        muteVideo: APP.UI.toggleVideo,
26
+        toggleFilmStrip: APP.UI.toggleFilmStrip,
27
+        toggleChat: APP.UI.toggleChat,
28
+        toggleContactList: APP.UI.toggleContactList
29
+    };
30
+}
27 31
 
28 32
 
29 33
 /**
@@ -176,6 +180,7 @@ var API = {
176 180
      * is initialized.
177 181
      */
178 182
     init: function () {
183
+        initCommands();
179 184
         if (window.addEventListener)
180 185
         {
181 186
             window.addEventListener('message',

+ 32
- 28
modules/keyboardshortcut/keyboardshortcut.js View File

@@ -1,38 +1,42 @@
1 1
 //maps keycode to character, id of popover for given function and function
2
-var shortcuts = {
3
-    67: {
4
-        character: "C",
5
-        id: "toggleChatPopover",
6
-        function: APP.UI.toggleChat
7
-    },
8
-    70: {
9
-        character: "F",
10
-        id: "filmstripPopover",
11
-        function: APP.UI.toggleFilmStrip
12
-    },
13
-    77: {
14
-        character: "M",
15
-        id: "mutePopover",
16
-        function: APP.UI.toggleAudio
17
-    },
18
-    84: {
19
-        character: "T",
20
-        function: function() {
21
-            if(!APP.RTC.localAudio.isMuted()) {
22
-                APP.UI.toggleAudio();
2
+var shortcuts = {};
3
+function initShortcutHandlers() {
4
+    shortcuts = {
5
+        67: {
6
+            character: "C",
7
+            id: "toggleChatPopover",
8
+            function: APP.UI.toggleChat
9
+        },
10
+        70: {
11
+            character: "F",
12
+            id: "filmstripPopover",
13
+            function: APP.UI.toggleFilmStrip
14
+        },
15
+        77: {
16
+            character: "M",
17
+            id: "mutePopover",
18
+            function: APP.UI.toggleAudio
19
+        },
20
+        84: {
21
+            character: "T",
22
+            function: function() {
23
+                if(!APP.RTC.localAudio.isMuted()) {
24
+                    APP.UI.toggleAudio();
25
+                }
23 26
             }
27
+        },
28
+        86: {
29
+            character: "V",
30
+            id: "toggleVideoPopover",
31
+            function: APP.UI.toggleVideo
24 32
         }
25
-    },
26
-    86: {
27
-        character: "V",
28
-        id: "toggleVideoPopover",
29
-        function: APP.UI.toggleVideo
30
-    }
31
-};
33
+    };
34
+}
32 35
 
33 36
 
34 37
 var KeyboardShortcut = {
35 38
     init: function () {
39
+        initShortcutHandlers();
36 40
         window.onkeyup = function(e) {
37 41
             var keycode = e.which;
38 42
             if(!($(":focus").is("input[type=text]") ||

Loading…
Cancel
Save