 Issue 4826014056185856:
  Add filtersLoaded and filterLoadListener to AdblockPlusApi  (Closed)
    
  
    Issue 4826014056185856:
  Add filtersLoaded and filterLoadListener to AdblockPlusApi  (Closed) 
  | 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(); | 
| +}); |