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

Unified Diff: lib/subscriptionInit.js

Issue 29339020: Issue 3868 - Use the new FilterNotifier API (Closed)
Patch Set: Created March 23, 2016, 8:15 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 | « lib/stats.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/subscriptionInit.js
===================================================================
--- a/lib/subscriptionInit.js
+++ b/lib/subscriptionInit.js
@@ -31,19 +31,6 @@
let firstRun;
let subscriptionsCallback = null;
-let filtersLoaded = new Promise(resolve =>
-{
- function onFilterAction(action)
- {
- if (action == "load")
- {
- FilterNotifier.removeListener(onFilterAction);
- resolve();
- }
- }
- FilterNotifier.addListener(onFilterAction);
-});
-
/**
* If there aren't any filters, the default subscriptions are added.
* However, if patterns.ini already did exist and/or any preference
@@ -172,9 +159,10 @@
initNotifications();
}
-Promise.all([filtersLoaded, Prefs.untilLoaded]).then(detectFirstRun)
- .then(getSubscriptions)
- .then(finishInitialization);
+Promise.all([FilterNotifier.once("load"),
+ Prefs.untilLoaded]).then(detectFirstRun)
+ .then(getSubscriptions)
+ .then(finishInitialization);
/**
* Indicates whether the default filter subscriptions have been added
« no previous file with comments | « lib/stats.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld