From 0b75b49b98965179133591425924e5610597613d Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sat, 15 Jun 2013 23:29:16 +0100 Subject: [PATCH] change the callback from resuming from idle, so it starts a short refresh timeout as if the map had just moved this way, if you switch back to IITC, then quickly move/zoom (as often is done), unnecessary network requests are avoided because of the change, there's no need for chat to have it's own resume hook - it already hooks into the refresh code and this is now triggered quickly --- code/boot.js | 2 +- code/chat.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/code/boot.js b/code/boot.js index e85cc24d..2a4eb924 100644 --- a/code/boot.js +++ b/code/boot.js @@ -198,7 +198,7 @@ window.setupMap = function() { map.on('movestart zoomstart', function() { window.mapRunsUserAction = true; window.requests.abort(); window.startRefreshTimeout(-1); }); map.on('moveend zoomend', function() { window.mapRunsUserAction = false; window.startRefreshTimeout(ON_MOVE_REFRESH*1000); }); - window.addResumeFunction(window.requestData); + window.addResumeFunction(function() { window.startRefreshTimeout(ON_MOVE_REFRESH*1000); }); window.requests.addRefreshFunction(window.requestData); // start the refresh process with a small timeout, so the first data request happens quickly diff --git a/code/chat.js b/code/chat.js index dabc3685..25ecc737 100644 --- a/code/chat.js +++ b/code/chat.js @@ -605,8 +605,6 @@ window.chat.setup = function() { if(scrollBottom(t) === 0) chat.requestPublic(false); }); - chat.request(); - window.addResumeFunction(chat.request); window.requests.addRefreshFunction(chat.request); var cls = PLAYER.team === 'ALIENS' ? 'enl' : 'res';