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

Unified Diff: adblockplus/Api.jsm

Issue 4826014056185856: Add filtersLoaded and filterLoadListener to AdblockPlusApi (Closed)
Patch Set: Use FilterStorage._loading to check if filters have been loaded Created March 20, 2015, 9:06 p.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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adblockplus/Api.jsm
===================================================================
--- a/adblockplus/Api.jsm
+++ b/adblockplus/Api.jsm
@@ -32,12 +32,18 @@
return result.exports;
}
+let {FilterNotifier} = require("filterNotifier");
let {FilterStorage} = require("filterStorage");
let {Prefs} = require("prefs");
let {UI} = require("ui");
var AdblockPlusApi =
{
+ get filtersLoaded()
+ {
+ return !FilterStorage._loading;
+ },
+ filterLoadListener: null,
get acceptableAdsEnabled()
{
return FilterStorage.subscriptions.some(
@@ -49,3 +55,13 @@
UI.toggleAcceptableAds();
}
};
+
+FilterNotifier.addListener(function filterListener(action)
+{
+ if (action != "load")
+ return;
+
+ if (typeof AdblockPlusApi.filterLoadListener == "function")
+ AdblockPlusApi.filterLoadListener();
+ FilterNotifier.removeListener(filterListener);
Wladimir Palant 2015/03/22 19:23:34 Please remove listener as the very first thing - f
Felix Dahlke 2015/03/22 20:59:31 Done.
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld