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: Remove filterListener before invoking filterLoadListener Created March 22, 2015, 8:59 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)
René Jeschke 2015/03/22 21:01:46 Oh, and from my side: we do not even really need t
Felix Dahlke 2015/03/22 21:13:28 Right, we _can't_ use it there, actually - interac
+{
+ if (action != "load")
+ return;
+
+ FilterNotifier.removeListener(filterListener);
+ if (typeof AdblockPlusApi.filterLoadListener == "function")
+ AdblockPlusApi.filterLoadListener();
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld