From c2a2e0aa01f537e1027ee474efff8ade9f576899 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Sat, 22 Aug 2020 16:28:36 +0200 Subject: Minor style changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jesús --- js/storage.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'js') diff --git a/js/storage.js b/js/storage.js index fd51235..c4447c4 100644 --- a/js/storage.js +++ b/js/storage.js @@ -530,28 +530,35 @@ Components.utils.import('chrome://ematrix/content/lib/Tools.jsm'); /******************************************************************************/ -ηMatrix.scheduleAssetUpdater = (function() { - var timer, next = 0; - return function(updateDelay) { - if ( timer ) { +ηMatrix.scheduleAssetUpdater = (function () { + let timer; + let next = 0; + + return function (updateDelay) { + if (timer) { clearTimeout(timer); timer = undefined; } - if ( updateDelay === 0 ) { + + if (updateDelay === 0) { next = 0; return; } - var now = Date.now(); - // Use the new schedule if and only if it is earlier than the previous - // one. - if ( next !== 0 ) { + + let now = Date.now(); + // Use the new schedule if and only if it is earlier than the + // previous one. + if (next !== 0) { updateDelay = Math.min(updateDelay, Math.max(next - now, 0)); } + next = now + updateDelay; - timer = vAPI.setTimeout(function() { + timer = vAPI.setTimeout(function () { timer = undefined; next = 0; - ηMatrix.assets.updateStart({ delay: 120000 }); + ηMatrix.assets.updateStart({ + delay: 120000 + }); }, updateDelay); }; })(); -- cgit v1.2.3