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; |
Wladimir Palant
2015/03/20 16:38:20
return FilterStorage._loading?
Felix Dahlke
2015/03/20 16:54:57
What we want to know here is whether the filters h
Felix Dahlke
2015/03/20 21:13:02
Well actually, you're right. Api.jsm is not necess
|
+ }, |
+ filterLoadListener: null, |
get acceptableAdsEnabled() |
{ |
return FilterStorage.subscriptions.some( |
@@ -49,3 +57,14 @@ |
UI.toggleAcceptableAds(); |
} |
}; |
+ |
+FilterNotifier.addListener(function(action) |
+{ |
+ if (action != "load") |
+ return; |
+ |
+ filtersLoaded = true; |
Wladimir Palant
2015/03/20 16:38:20
This listener should be removed after the first ca
Felix Dahlke
2015/03/20 16:54:57
Done.
Felix Dahlke
2015/03/20 17:13:06
Well, NOW it's done. Misunderstood you, unregister
|
+ if ("filterLoadListener" in AdblockPlusApi && |
+ typeof AdblockPlusApi.filterLoadListener == "function") |
Wladimir Palant
2015/03/20 16:38:20
Using typeof is sufficient, "filterLoadListener" i
Felix Dahlke
2015/03/20 16:54:57
Ouch, getting rusty...
|
+ AdblockPlusApi.filterLoadListener(); |
+}); |