Index: lib/init.js |
=================================================================== |
--- a/lib/init.js |
+++ b/lib/init.js |
@@ -10,72 +10,77 @@ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
+"use strict"; |
+ |
let {Prefs} = require("prefs"); |
let {FilterNotifier} = require("filterNotifier"); |
let filtersInitDone = false; |
-function checkInitialized() |
+let checkInitialized = () => |
{ |
if (Prefs.initialized && filtersInitDone) |
{ |
- checkInitialized = function() {}; |
+ checkInitialized = () => {}; |
_triggerEvent("_init", require("filterStorage").FilterStorage.firstRun); |
} |
-} |
+}; |
Prefs._initListener = function() |
{ |
checkInitialized(); |
}; |
if (Prefs.initialized) |
checkInitialized(); |
-FilterNotifier.addListener(function(action) |
+FilterNotifier.addListener(action => |
{ |
if (action === "load") |
{ |
let {FilterStorage} = require("filterStorage"); |
if (FilterStorage.firstRun) |
{ |
// No data, must be a new user or someone with corrupted data - initialize |
// with default settings |
- let {Subscription, DownloadableSubscription} = require("subscriptionClasses"); |
+ let {Subscription, DownloadableSubscription} = |
sergei
2017/09/18 07:59:05
should it and a couple of lines below be rather co
hub
2017/09/18 12:43:05
Done.
|
+ require("subscriptionClasses"); |
let {Synchronizer} = require("synchronizer"); |
- let {Prefs} = require("prefs"); |
let {Utils} = require("utils"); |
if (Prefs.first_run_subscription_auto_select) |
{ |
let subscriptions = require("subscriptions.xml"); |
let node = Utils.chooseFilterSubscription(subscriptions); |
if (node) |
{ |
let subscription = Subscription.fromURL(node.url); |
subscription.disabled = false; |
subscription.title = node.title; |
subscription.homepage = node.homepage; |
FilterStorage.addSubscription(subscription); |
- if (subscription instanceof DownloadableSubscription && !subscription.lastDownload) |
+ if (subscription instanceof DownloadableSubscription && |
+ !subscription.lastDownload) |
Synchronizer.execute(subscription); |
} |
- let aaSubscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl); |
+ let aaSubscription = |
+ Subscription.fromURL(Prefs.subscriptions_exceptionsurl); |
aaSubscription.disabled = false; |
FilterStorage.addSubscription(aaSubscription); |
- if (aaSubscription instanceof DownloadableSubscription && !aaSubscription.lastDownload) |
+ if (aaSubscription instanceof DownloadableSubscription && |
+ !aaSubscription.lastDownload) |
Synchronizer.execute(aaSubscription); |
} |
} |
filtersInitDone = true; |
checkInitialized(); |
} |
}); |