From: Michael Prager Date: Tue, 23 Nov 2010 14:04:28 +0000 (+0100) Subject: fixed update timer not being updated when changing update interval in settings X-Git-Url: https://code.delx.au/comingnext/commitdiff_plain/34fd186d3247b6b11faa7ad5cce8391ab5e7e3b6 fixed update timer not being updated when changing update interval in settings --- diff --git a/comingNext/index.html b/comingNext/index.html index 445fe64..f098716 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -95,6 +95,8 @@ var settingsCache = null; var notificationRequests = new Array(); var calendarList = []; var calendarColors = []; +var updateTimer = null; +var screenRotationTimer = null; // vars for daylight saving time var summertime = false; // true, if current date is in summer, false if in winter @@ -837,9 +839,8 @@ function init() collectLocales(); //updateData(); requestNotification(); - window.setInterval('updateData()', 1000 * 60 * config['updateDataInterval'].Value); document.getElementById("settingsTitle").innerHTML = getLocalizedText('menu.settings'); - + setUpdateTimer(); if (window.innerHeight > 91) { mode = 0; // we're starting fullscreen, we set mode to homescreen in order to let updateScreen() do all the work for us } @@ -850,10 +851,26 @@ function init() updateScreen(); if (config['useBackgroundImage'].Value) // check for screen rotation every 1 secs - window.setInterval('updateScreen()', 1000 * 1); + screenRotationTimer = window.setInterval('updateScreen()', 1000 * 1); console.info("init(): finished..."); } +function setUpdateTimer() +{ + updateTimer = window.setInterval('updateTimerCallback()', 1000 * 60 * config['updateDataInterval'].Value); +} + +function clearUpdateTimer() +{ + window.clearInterval(updateTimer); +} + +function updateTimerCallback() +{ + console.info("updateTimerCallback()"); + updateData(); +} + function createMenu() { window.menu.setLeftSoftkeyLabel("",null); @@ -1099,6 +1116,9 @@ function saveSettings() } catch (e) { error("saveSettings: " + e + ', line ' + e.line); } + + clearUpdateTimer(); + setUpdateTimer(); } function toggleVisibility(elementId)