From 3767990bb0214888889c2020ea238751bd89a5c9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 10 Jul 2016 21:31:35 -0700 Subject: [PATCH] Fix some app list refreshing bugs --- static/js/index.js | 10 +++------- static/js/messages.js | 2 +- static/js/utils.js | 11 ----------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index bfefae4..0f6323a 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -222,14 +222,10 @@ function showApps() { return; } + // if game grid is populated, empty it + $("#game-grid").empty(); + api.getAppList().then(function (appList) { - - // if game grid is populated, empty it - if($("#game-grid").children().length > 0) { - $("#game-grid").empty(); - } - - appList.forEach(function (app) { api.getBoxArt(app.id).then(function (resolvedPromise) { var imageBlob = new Blob([resolvedPromise], {type: "image/png"}); diff --git a/static/js/messages.js b/static/js/messages.js index 4586396..cc223c8 100644 --- a/static/js/messages.js +++ b/static/js/messages.js @@ -23,7 +23,7 @@ function handleMessage(msg) { if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function $('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream. api.refreshServerInfo().then(function (ret) { - showAppsMode(); + showApps(); chrome.app.window.current().restore(); }); } else if(msg.data === 'Connection Established') { diff --git a/static/js/utils.js b/static/js/utils.js index f480c14..27e430a 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -40,7 +40,6 @@ function NvHTTP(address, clientUid) { this.clientUid = clientUid; this._baseUrlHttps = 'https://' + address + ':47984'; this._baseUrlHttp = 'http://' + address + ':47989'; - this._appListCache = null; this._memCachedBoxArtArray = {}; _self = this; }; @@ -133,13 +132,6 @@ NvHTTP.prototype = { }, getAppList: function () { - if (_self._appListCache) { - console.log('Returning app list from cache'); - return new Promise(function (resolve, reject) { - resolve(_self._appListCache); - }); - } - return sendMessage('openUrl', [_self._baseUrlHttps + '/applist?' + _self._buildUidStr(), false]).then(function (ret) { $xml = _self._parseXML(ret); @@ -155,9 +147,6 @@ NvHTTP.prototype = { }); } - if (appList) - _self._appListCache = appList; - return appList; }); },