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,14 @@ |
UI.toggleAcceptableAds(); |
} |
}; |
+ |
+FilterNotifier.addListener(function filterListener(action) |
+{ |
+ if (action != "load") |
+ return; |
+ |
+ filtersLoaded = true; |
+ if (typeof AdblockPlusApi.filterLoadListener == "function") |
+ AdblockPlusApi.filterLoadListener(); |
+ FilterNotifier.removeListener(filterListener); |
+}); |