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

Unified Diff: lib/init.js

Issue 5740786045943808: Issue 189 - Implement API changes from #117, #153, #192 in libadblockplus (Closed)
Patch Set: Created April 14, 2014, 9:14 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 | « .hgsubstate ('k') | lib/io.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/init.js
===================================================================
--- a/lib/init.js
+++ b/lib/init.js
@@ -15,45 +15,42 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
let {Prefs} = require("prefs");
let {FilterNotifier} = require("filterNotifier");
let prefsInitDone = false;
let filtersInitDone = false;
-let isFirstRun = false;
function checkInitialized()
{
if (prefsInitDone && filtersInitDone)
{
checkInitialized = function() {};
- _triggerEvent("init", isFirstRun);
+ _triggerEvent("init", require("filterStorage").FilterStorage.firstRun);
Felix Dahlke 2014/04/23 09:43:22 Also required below, I'd vote for doing this once
Wladimir Palant 2014/04/23 10:40:36 This isn't a real module loading mechanism here, m
Felix Dahlke 2014/04/24 11:11:41 Well, that's a leaky abstraction if there ever was
}
}
Prefs._initListener = function()
{
prefsInitDone = true;
checkInitialized();
};
FilterNotifier.addListener(function(action)
{
if (action === "load")
{
let {FilterStorage} = require("filterStorage");
- if (FilterStorage.subscriptions.length == 0)
+ if (FilterStorage.firstRun)
{
// No data, must be a new user or someone with corrupted data - initialize
// with default settings
- isFirstRun = true;
-
let {Subscription, DownloadableSubscription} = require("subscriptionClasses");
let {Synchronizer} = require("synchronizer");
let {Prefs} = require("prefs");
let {Utils} = require("utils");
// Choose default subscription and add it
let subscriptions = require("subscriptions.xml");
let node = Utils.chooseFilterSubscription(subscriptions);
« no previous file with comments | « .hgsubstate ('k') | lib/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld