cleaned up some unnecessary NvHTTP calls to make things faster

This commit is contained in:
R. Aidan Campbell 2016-03-13 13:09:09 -04:00
parent 8a31d90342
commit de464802cf
2 changed files with 12 additions and 10 deletions

View File

@ -170,13 +170,11 @@ function showAppsMode() {
// in theory we should be able to cache the api.currentGame to prevent another call. // in theory we should be able to cache the api.currentGame to prevent another call.
function gameSelectUpdated() { function gameSelectUpdated() {
var currentApp = $("#selectGame").val(); var currentApp = $("#selectGame").val();
api.refreshServerInfo().then(function (ret) { if(api.currentGame == parseInt(currentApp)) {
if(api.currentGame == parseInt(currentApp)) { $("#startGameButton")[0].innerHTML = 'Resume Game'
$("#startGameButton")[0].innerHTML = 'Resume Game' } else {
} else { $("#startGameButton")[0].innerHTML = 'Run Game'
$("#startGameButton")[0].innerHTML = 'Run Game' }
}
});
} }
function startSelectedGame() { function startSelectedGame() {
@ -286,8 +284,10 @@ function stopGame(callbackFunction) {
var appName = runningApp.title; var appName = runningApp.title;
snackbarLog('Stopping ' + appName); snackbarLog('Stopping ' + appName);
api.quitApp().then(function (ret2) { api.quitApp().then(function (ret2) {
showAppsMode(); api.refreshServerInfo().then(function (ret3) { // refresh to show no app is currently running.
if (typeof(callbackFunction) === "function") callbackFunction(); showAppsMode();
if (typeof(callbackFunction) === "function") callbackFunction();
});
}); });
}); });
}); });

View File

@ -21,7 +21,9 @@ function handleMessage(msg) {
} else { // else, it's just info, or an event } else { // else, it's just info, or an event
console.log(msg.data); console.log(msg.data);
if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function
showAppsMode(); api.refreshServerInfo().then(function (ret) {
showAppsMode();
});
} }
} }
} }