aboutsummaryrefslogtreecommitdiffstats
path: root/js/storage.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/storage.js')
-rw-r--r--js/storage.js29
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);
};
})();