diff --git a/package.json b/package.json index 1aee4b6afb..b6080caff7 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build:main": "webpack --config webpack.main.js", "build:renderer": "webpack --config webpack.renderer.js", "build:renderer:watch": "webpack --config webpack.renderer.js --watch", - "electron": "(npm run build:main | npm run build:renderer) & (electron ./build --dev --watch | npm run build:renderer:watch)" + "electron": "(npm run build:main | npm run build:renderer) && (electron ./build --dev --watch | npm run build:renderer:watch)" }, "devDependencies": { "@bitwarden/jslib": "git+https://github.com/bitwarden/jslib.git", diff --git a/src/main.ts b/src/main.ts index adf86bf9c8..e7bd95d151 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,10 +19,10 @@ const windowMain = new WindowMain(dev); const messagingMain = new MessagingMain(windowMain); const menuMain = new MenuMain(windowMain, i18nService); -windowMain.init(); -messagingMain.init(); - -i18nService.init().then(() => { +windowMain.init().then(() => { + messagingMain.init(); + return i18nService.init(); +}).then(() => { menuMain.init(); }, (e: any) => { console.log(e); diff --git a/src/main/menu.main.ts b/src/main/menu.main.ts index 2542d341dc..c0f89071ea 100644 --- a/src/main/menu.main.ts +++ b/src/main/menu.main.ts @@ -329,7 +329,7 @@ export class MenuMain { if (process.platform === 'darwin') { template[0].label = app.getName(); - (template[0].submenu as MenuItemConstructorOptions[]).concat([ + template[0].submenu = (template[0].submenu as MenuItemConstructorOptions[]).concat([ { type: 'separator' }, { role: 'about' }, { type: 'separator' }, diff --git a/src/main/window.main.ts b/src/main/window.main.ts index 281d1d5a7c..ef8f5a3825 100644 --- a/src/main/window.main.ts +++ b/src/main/window.main.ts @@ -7,34 +7,40 @@ export class WindowMain { constructor(private dev: boolean) { } - init() { - try { - // This method will be called when Electron has finished - // initialization and is ready to create browser windows. - // Some APIs can only be used after this event occurs. - app.on('ready', () => this.createWindow()); - - // Quit when all windows are closed. - app.on('window-all-closed', () => { - // On OS X it is common for applications and their menu bar - // to stay active until the user quits explicitly with Cmd + Q - if (process.platform !== 'darwin') { - app.quit(); - } - }); - - app.on('activate', () => { - // On OS X it's common to re-create a window in the app when the - // dock icon is clicked and there are no other windows open. - if (this.win === null) { + init(): Promise { + return new Promise((resolve, reject) => { + try { + // This method will be called when Electron has finished + // initialization and is ready to create browser windows. + // Some APIs can only be used after this event occurs. + app.on('ready', () => { this.createWindow(); - } - }); - - } catch (e) { - // Catch Error - // throw e; - } + resolve(); + }); + + // Quit when all windows are closed. + app.on('window-all-closed', () => { + // On OS X it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform !== 'darwin') { + app.quit(); + } + }); + + app.on('activate', () => { + // On OS X it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open. + if (this.win === null) { + this.createWindow(); + } + }); + + } catch (e) { + // Catch Error + // throw e; + reject(e); + } + }); } private createWindow() {