Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29996582: Issue 7257 - Throttle badge updates (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Feb. 3, 2019, 6:14 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/stats.js » ('j') | lib/stats.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -520,9 +520,30 @@
}
};
}
return ext.onMessage._dispatch(
message, sender, sendResponse
).includes(true);
});
+
+
+ /* Utilities */
+
+ let Scheduler = ext.Scheduler = function()
+ {
+ this.scheduled = false;
+ };
+ Scheduler.prototype = {
+ schedule(delay, func)
+ {
+ setTimeout(() =>
+ {
+ this.scheduled = false;
+ func();
+ },
+ delay);
+
+ this.scheduled = true;
+ }
+ };
Sebastian Noack 2019/02/03 23:18:03 Please don't add new stuff to ext.*, we eventually
Manish Jethani 2019/02/04 05:33:03 I've moved it into lib/stats.js for now, although
Sebastian Noack 2019/02/04 06:32:04 Well, IMO this pattern isn't worth to be abstracte
Manish Jethani 2019/02/04 06:57:17 Acknowledged.
}
« no previous file with comments | « no previous file | lib/stats.js » ('j') | lib/stats.js » ('J')

Powered by Google App Engine
This is Rietveld