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.
function gameSelectUpdated() {
var currentApp = $("#selectGame").val();
api.refreshServerInfo().then(function (ret) {
if(api.currentGame == parseInt(currentApp)) {
$("#startGameButton")[0].innerHTML = 'Resume Game'
} else {
$("#startGameButton")[0].innerHTML = 'Run Game'
}
});
}
function startSelectedGame() {
@ -286,11 +284,13 @@ function stopGame(callbackFunction) {
var appName = runningApp.title;
snackbarLog('Stopping ' + appName);
api.quitApp().then(function (ret2) {
api.refreshServerInfo().then(function (ret3) { // refresh to show no app is currently running.
showAppsMode();
if (typeof(callbackFunction) === "function") callbackFunction();
});
});
});
});
}
function storeData(key, data, callbackFunction) {

View File

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