diff options
author | Alessio Vanni <vannilla@firemail.cc> | 2020-08-22 16:28:36 +0200 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2022-04-06 04:20:41 +0800 |
commit | c2a2e0aa01f537e1027ee474efff8ade9f576899 (patch) | |
tree | 426be8d9415c3f197eac09fc41c32334557a78f7 /js | |
parent | 7c387870302795723aa2008614c8fb549debc20d (diff) | |
download | ematrix-c2a2e0aa01f537e1027ee474efff8ade9f576899.tar.lz ematrix-c2a2e0aa01f537e1027ee474efff8ade9f576899.tar.xz ematrix-c2a2e0aa01f537e1027ee474efff8ade9f576899.zip |
Minor style changes
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'js')
-rw-r--r-- | js/storage.js | 29 |
1 files changed, 18 insertions, 11 deletions
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); }; })(); |