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: Discard listener, remove redundant check Created March 20, 2015, 4:53 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,20 @@
return result.exports;
}
+let {FilterNotifier} = require("filterNotifier");
let {FilterStorage} = require("filterStorage");
let {Prefs} = require("prefs");
let {UI} = require("ui");
+let filtersLoaded = false;
+
var AdblockPlusApi =
{
+ get filtersLoaded()
+ {
+ return filtersLoaded;
+ },
+ filterLoadListener: null,
get acceptableAdsEnabled()
{
return FilterStorage.subscriptions.some(
@@ -49,3 +57,16 @@
UI.toggleAcceptableAds();
}
};
+
+FilterNotifier.addListener(function(action)
+{
+ if (action != "load")
+ return;
+
+ filtersLoaded = true;
+ if (typeof AdblockPlusApi.filterLoadListener == "function")
+ {
+ AdblockPlusApi.filterLoadListener();
+ AdblockPlusApi.filterLoadListener = null;
+ }
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld