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

This commit is contained in:
Devin Wilson 2015-07-02 15:33:06 -06:00
parent 072905b7cd
commit 829d8dab16
3 changed files with 98 additions and 113 deletions

View File

@ -73,15 +73,19 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
* filmStrip: toggleFilmStrip * filmStrip: toggleFilmStrip
* }} * }}
*/ */
var commands = var commands = {};
{
displayName: APP.UI.inputDisplayNameHandler, function initCommands() {
muteAudio: APP.UI.toggleAudio, commands =
muteVideo: APP.UI.toggleVideo, {
toggleFilmStrip: APP.UI.toggleFilmStrip, displayName: APP.UI.inputDisplayNameHandler,
toggleChat: APP.UI.toggleChat, muteAudio: APP.UI.toggleAudio,
toggleContactList: APP.UI.toggleContactList muteVideo: APP.UI.toggleVideo,
}; toggleFilmStrip: APP.UI.toggleFilmStrip,
toggleChat: APP.UI.toggleChat,
toggleContactList: APP.UI.toggleContactList
};
}
/** /**
@ -234,6 +238,7 @@ var API = {
* is initialized. * is initialized.
*/ */
init: function () { init: function () {
initCommands();
if (window.addEventListener) if (window.addEventListener)
{ {
window.addEventListener('message', window.addEventListener('message',
@ -11503,40 +11508,44 @@ module.exports = {
},{"../../service/RTC/RTCEvents":99,"../../service/desktopsharing/DesktopSharingEventTypes":105,"../RTC/RTCBrowserType":8,"../RTC/adapter.screenshare":10,"events":109}],45:[function(require,module,exports){ },{"../../service/RTC/RTCEvents":99,"../../service/desktopsharing/DesktopSharingEventTypes":105,"../RTC/RTCBrowserType":8,"../RTC/adapter.screenshare":10,"events":109}],45:[function(require,module,exports){
//maps keycode to character, id of popover for given function and function //maps keycode to character, id of popover for given function and function
var shortcuts = { var shortcuts = {};
67: { function initShortcutHandlers() {
character: "C", shortcuts = {
id: "toggleChatPopover", 67: {
function: APP.UI.toggleChat character: "C",
}, id: "toggleChatPopover",
70: { function: APP.UI.toggleChat
character: "F", },
id: "filmstripPopover", 70: {
function: APP.UI.toggleFilmStrip character: "F",
}, id: "filmstripPopover",
77: { function: APP.UI.toggleFilmStrip
character: "M", },
id: "mutePopover", 77: {
function: APP.UI.toggleAudio character: "M",
}, id: "mutePopover",
84: { function: APP.UI.toggleAudio
character: "T", },
function: function() { 84: {
if(!APP.RTC.localAudio.isMuted()) { character: "T",
APP.UI.toggleAudio(); function: function() {
if(!APP.RTC.localAudio.isMuted()) {
APP.UI.toggleAudio();
}
} }
},
86: {
character: "V",
id: "toggleVideoPopover",
function: APP.UI.toggleVideo
} }
}, };
86: { }
character: "V",
id: "toggleVideoPopover",
function: APP.UI.toggleVideo
}
};
var KeyboardShortcut = { var KeyboardShortcut = {
init: function () { init: function () {
initShortcutHandlers();
window.onkeyup = function(e) { window.onkeyup = function(e) {
var keycode = e.which; var keycode = e.which;
if(!($(":focus").is("input[type=text]") || if(!($(":focus").is("input[type=text]") ||
@ -30348,70 +30357,37 @@ function isUndefined(arg) {
var process = module.exports = {}; var process = module.exports = {};
var queue = []; var queue = [];
var draining = false; var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() { function drainQueue() {
if (draining) { if (draining) {
return; return;
} }
var timeout = setTimeout(cleanUpNextTick);
draining = true; draining = true;
var currentQueue;
var len = queue.length; var len = queue.length;
while(len) { while(len) {
currentQueue = queue; currentQueue = queue;
queue = []; queue = [];
while (++queueIndex < len) { var i = -1;
currentQueue[queueIndex].run(); while (++i < len) {
currentQueue[i]();
} }
queueIndex = -1;
len = queue.length; len = queue.length;
} }
currentQueue = null;
draining = false; draining = false;
clearTimeout(timeout);
} }
process.nextTick = function (fun) { process.nextTick = function (fun) {
var args = new Array(arguments.length - 1); queue.push(fun);
if (arguments.length > 1) { if (!draining) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0); setTimeout(drainQueue, 0);
} }
}; };
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser'; process.title = 'browser';
process.browser = true; process.browser = true;
process.env = {}; process.env = {};
process.argv = []; process.argv = [];
process.version = ''; // empty string to avoid regexp issues process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {} function noop() {}

View File

@ -15,15 +15,19 @@ var XMPPEvents = require("../../service/xmpp/XMPPEvents");
* filmStrip: toggleFilmStrip * filmStrip: toggleFilmStrip
* }} * }}
*/ */
var commands = var commands = {};
{
displayName: APP.UI.inputDisplayNameHandler, function initCommands() {
muteAudio: APP.UI.toggleAudio, commands =
muteVideo: APP.UI.toggleVideo, {
toggleFilmStrip: APP.UI.toggleFilmStrip, displayName: APP.UI.inputDisplayNameHandler,
toggleChat: APP.UI.toggleChat, muteAudio: APP.UI.toggleAudio,
toggleContactList: APP.UI.toggleContactList muteVideo: APP.UI.toggleVideo,
}; toggleFilmStrip: APP.UI.toggleFilmStrip,
toggleChat: APP.UI.toggleChat,
toggleContactList: APP.UI.toggleContactList
};
}
/** /**
@ -176,6 +180,7 @@ var API = {
* is initialized. * is initialized.
*/ */
init: function () { init: function () {
initCommands();
if (window.addEventListener) if (window.addEventListener)
{ {
window.addEventListener('message', window.addEventListener('message',

View File

@ -1,38 +1,42 @@
//maps keycode to character, id of popover for given function and function //maps keycode to character, id of popover for given function and function
var shortcuts = { var shortcuts = {};
67: { function initShortcutHandlers() {
character: "C", shortcuts = {
id: "toggleChatPopover", 67: {
function: APP.UI.toggleChat character: "C",
}, id: "toggleChatPopover",
70: { function: APP.UI.toggleChat
character: "F", },
id: "filmstripPopover", 70: {
function: APP.UI.toggleFilmStrip character: "F",
}, id: "filmstripPopover",
77: { function: APP.UI.toggleFilmStrip
character: "M", },
id: "mutePopover", 77: {
function: APP.UI.toggleAudio character: "M",
}, id: "mutePopover",
84: { function: APP.UI.toggleAudio
character: "T", },
function: function() { 84: {
if(!APP.RTC.localAudio.isMuted()) { character: "T",
APP.UI.toggleAudio(); function: function() {
if(!APP.RTC.localAudio.isMuted()) {
APP.UI.toggleAudio();
}
} }
},
86: {
character: "V",
id: "toggleVideoPopover",
function: APP.UI.toggleVideo
} }
}, };
86: { }
character: "V",
id: "toggleVideoPopover",
function: APP.UI.toggleVideo
}
};
var KeyboardShortcut = { var KeyboardShortcut = {
init: function () { init: function () {
initShortcutHandlers();
window.onkeyup = function(e) { window.onkeyup = function(e) {
var keycode = e.which; var keycode = e.which;
if(!($(":focus").is("input[type=text]") || if(!($(":focus").is("input[type=text]") ||