Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/ui.js

Issue 29345633: Issue 4133 - Switch to new FilterNotifier API in UI module (Closed)
Patch Set: Created June 7, 2016, 4:33 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: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -393,31 +393,35 @@ let UI = exports.UI =
* can be added to the UI.
*/
initDone: function()
{
// The icon might be added already, make sure its state is correct
this.updateState();
// Listen for pref and filters changes
- Prefs.addListener(function(name)
+ Prefs.addListener(name =>
{
if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaultstatusbaraction")
this.updateState();
else if (name == "showinstatusbar")
{
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 =>
{
let window = this.currentWindow;
if (!window)
return;
let button = window.document.getElementById("abp-toolbarbutton")
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld