From 7a87c7609155cb91681b45747ab63cf2c1df7cf9 Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Thu, 2 Mar 2017 11:02:08 -0700 Subject: [PATCH] more verbose logging, fixed minor namespace pollution --- static/js/background.js | 1 + static/js/index.js | 10 ++++++---- static/js/utils.js | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/static/js/background.js b/static/js/background.js index 027af33..14a3a06 100644 --- a/static/js/background.js +++ b/static/js/background.js @@ -16,6 +16,7 @@ function createWindow(state) { } chrome.app.runtime.onLaunched.addListener(function() { + console.log('Chrome app runtime launched.'); var windowState = 'normal'; if (chrome.storage) { diff --git a/static/js/index.js b/static/js/index.js index 642b837..f2cda47 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -76,7 +76,7 @@ function restoreUiAfterNaClLoad() { $('#naclSpinner').hide(); $('#loadingSpinner').css('display', 'none'); showHostsAndSettingsMode(); - for(hostUID in hosts) { + for(var hostUID in hosts) { beginBackgroundPollingOfHost(hosts[hostUID]); } @@ -579,10 +579,10 @@ function playGameMode() { $(".mdl-layout__header").hide(); $("#main-content").children().not("#listener, #loadingSpinner").hide(); $("#main-content").addClass("fullscreen"); - fullscreenNaclModule(); $("body").css('backgroundColor', 'black'); chrome.app.window.current().fullscreen(); + fullscreenNaclModule(); $('#loadingSpinner').css('display', 'inline-block'); } @@ -691,7 +691,7 @@ function saveFramerate() { // unfortunately, objects with function instances (classes) are stripped of their function instances when converted to a raw object // so we cannot forget to revive the object after we load it. function saveHosts() { - for(hostUID in hosts) { + for(var hostUID in hosts) { // slim the object down to only store the necessary bytes, because we have limited storage hosts[hostUID]._prepareForStorage(); } @@ -741,6 +741,7 @@ function updateDefaultBitrate() { } function onWindowLoad(){ + console.log('Window loaded.'); // don't show the game selection div $('#gameSelection').css('display', 'none'); @@ -787,13 +788,14 @@ function onWindowLoad(){ // load previously connected hosts, which have been killed into an object, and revive them back into a class chrome.storage.sync.get('hosts', function(previousValue) { hosts = previousValue.hosts != null ? previousValue.hosts : {}; - for(hostUID in hosts) { // programmatically add each new host. + for(var hostUID in hosts) { // programmatically add each new host. var revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid, hosts[hostUID].userEnteredAddress); revivedHost.serverUid = hosts[hostUID].serverUid; revivedHost.externalIP = hosts[hostUID].externalIP; revivedHost.hostname = hosts[hostUID].hostname; addHostToGrid(revivedHost); } + console.log('Loaded previously connected hosts.'); }); } } diff --git a/static/js/utils.js b/static/js/utils.js index b2dd654..93fc9f2 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -165,7 +165,7 @@ NvHTTP.prototype = { string += 'gpu type: ' + this.gputype + '\r\n'; string += 'number of apps: ' + this.numofapps + '\r\n'; string += 'supported display modes: ' + '\r\n'; - for(displayMode in this.supportedDisplayModes) { + for(var displayMode in this.supportedDisplayModes) { string += '\t' + displayMode + ': ' + this.supportedDisplayModes[displayMode] + '\r\n'; } return string;