more verbose logging, fixed minor namespace pollution

This commit is contained in:
R. Aidan Campbell 2017-03-02 11:02:08 -07:00
parent 2d4fc6628f
commit 7a87c76091
3 changed files with 8 additions and 5 deletions

View File

@ -16,6 +16,7 @@ function createWindow(state) {
} }
chrome.app.runtime.onLaunched.addListener(function() { chrome.app.runtime.onLaunched.addListener(function() {
console.log('Chrome app runtime launched.');
var windowState = 'normal'; var windowState = 'normal';
if (chrome.storage) { if (chrome.storage) {

View File

@ -76,7 +76,7 @@ function restoreUiAfterNaClLoad() {
$('#naclSpinner').hide(); $('#naclSpinner').hide();
$('#loadingSpinner').css('display', 'none'); $('#loadingSpinner').css('display', 'none');
showHostsAndSettingsMode(); showHostsAndSettingsMode();
for(hostUID in hosts) { for(var hostUID in hosts) {
beginBackgroundPollingOfHost(hosts[hostUID]); beginBackgroundPollingOfHost(hosts[hostUID]);
} }
@ -579,10 +579,10 @@ function playGameMode() {
$(".mdl-layout__header").hide(); $(".mdl-layout__header").hide();
$("#main-content").children().not("#listener, #loadingSpinner").hide(); $("#main-content").children().not("#listener, #loadingSpinner").hide();
$("#main-content").addClass("fullscreen"); $("#main-content").addClass("fullscreen");
fullscreenNaclModule();
$("body").css('backgroundColor', 'black'); $("body").css('backgroundColor', 'black');
chrome.app.window.current().fullscreen(); chrome.app.window.current().fullscreen();
fullscreenNaclModule();
$('#loadingSpinner').css('display', 'inline-block'); $('#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 // 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. // so we cannot forget to revive the object after we load it.
function saveHosts() { 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 // slim the object down to only store the necessary bytes, because we have limited storage
hosts[hostUID]._prepareForStorage(); hosts[hostUID]._prepareForStorage();
} }
@ -741,6 +741,7 @@ function updateDefaultBitrate() {
} }
function onWindowLoad(){ function onWindowLoad(){
console.log('Window loaded.');
// don't show the game selection div // don't show the game selection div
$('#gameSelection').css('display', 'none'); $('#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 // 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) { chrome.storage.sync.get('hosts', function(previousValue) {
hosts = previousValue.hosts != null ? previousValue.hosts : {}; 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); var revivedHost = new NvHTTP(hosts[hostUID].address, myUniqueid, hosts[hostUID].userEnteredAddress);
revivedHost.serverUid = hosts[hostUID].serverUid; revivedHost.serverUid = hosts[hostUID].serverUid;
revivedHost.externalIP = hosts[hostUID].externalIP; revivedHost.externalIP = hosts[hostUID].externalIP;
revivedHost.hostname = hosts[hostUID].hostname; revivedHost.hostname = hosts[hostUID].hostname;
addHostToGrid(revivedHost); addHostToGrid(revivedHost);
} }
console.log('Loaded previously connected hosts.');
}); });
} }
} }

View File

@ -165,7 +165,7 @@ NvHTTP.prototype = {
string += 'gpu type: ' + this.gputype + '\r\n'; string += 'gpu type: ' + this.gputype + '\r\n';
string += 'number of apps: ' + this.numofapps + '\r\n'; string += 'number of apps: ' + this.numofapps + '\r\n';
string += 'supported display modes: ' + '\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'; string += '\t' + displayMode + ': ' + this.supportedDisplayModes[displayMode] + '\r\n';
} }
return string; return string;