From 72ac90157febedec8f8f9df5618e7c4c0962f0cd Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 5 Dec 2017 23:37:32 -0500 Subject: [PATCH] bootstrap async --- src/background.js | 6 +++--- src/background/main.background.ts | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/background.js b/src/background.js index ba585b5796..a78d02026c 100644 --- a/src/background.js +++ b/src/background.js @@ -4,7 +4,7 @@ import i18nService from './services/i18nService.js'; window.forge = require('node-forge'); window.tldjs = require('tldjs'); -window.bg_isBackground = true; -window.bg_main = new MainBackground(new i18nService()); +const bg_isBackground = window.bg_isBackground = true; +const bg_main = window.bg_main = new MainBackground(new i18nService()); require('./scripts/analytics.js'); -window.bg_main.bootstrap(); +bg_main.bootstrap(); diff --git a/src/background/main.background.ts b/src/background/main.background.ts index ca915e12c2..d21237337a 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -82,7 +82,7 @@ export default class MainBackground { opr.sidebarAction : (window as any).chrome.sidebarAction; } - bootstrap() { + async bootstrap() { // Chrome APIs if (chrome.commands) { chrome.commands.onCommand.addListener((command: any) => { @@ -323,11 +323,10 @@ export default class MainBackground { } // Bootstrap - this.environmentService.setUrlsFromStorage().then(() => { - this.setIcon(); - this.cleanupLoginsToAdd(); - this.fullSync(true); - }); + await this.environmentService.setUrlsFromStorage(); + this.setIcon(); + this.cleanupLoginsToAdd(); + this.fullSync(true); } private completeAuthRequest(details: any) {