[Pkg-mozext-commits] [adblock-plus] 10/98: Issue 4133 - Switch to new FilterNotifier API in UI module

David Prévot taffit at moszumanska.debian.org
Tue Oct 24 01:30:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit ab4d932ce73c0d05dd50bf45bc4693c75d2735e7
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Jun 7 18:33:26 2016 +0200

    Issue 4133 - Switch to new FilterNotifier API in UI module
---
 lib/ui.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/ui.js b/lib/ui.js
index 6240969..e1643bc 100644
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -413,7 +413,7 @@ let UI = exports.UI =
     this.updateState();
 
     // Listen for pref and filters changes
-    Prefs.addListener(function(name)
+    Prefs.addListener(name =>
     {
       if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaultstatusbaraction")
         this.updateState();
@@ -422,12 +422,16 @@ let UI = exports.UI =
         for (let window of this.applicationWindows)
           this.updateStatusbarIcon(window);
       }
-    }.bind(this));
-    FilterNotifier.addListener(function(action)
+    });
+
+    for (let eventName of [
+      "filter.added", "filter.removed", "filter.disabled",
+      "subscription.added", "subscription.removed", "subscription.disabled",
+      "subscription.updated", "load"
+    ])
     {
-      if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(action) || action == "load")
-        this.updateState();
-    }.bind(this));
+      FilterNotifier.on(eventName, () => this.updateState());
+    }
 
     Notification.addShowListener(notification =>
     {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list