1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

init menu after app ready

This commit is contained in:
Kyle Spearrin 2018-02-10 11:58:14 -05:00
parent 214d8f7ae8
commit 884eefd589
4 changed files with 39 additions and 33 deletions

View File

@ -8,7 +8,7 @@
"build:main": "webpack --config webpack.main.js", "build:main": "webpack --config webpack.main.js",
"build:renderer": "webpack --config webpack.renderer.js", "build:renderer": "webpack --config webpack.renderer.js",
"build:renderer:watch": "webpack --config webpack.renderer.js --watch", "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": { "devDependencies": {
"@bitwarden/jslib": "git+https://github.com/bitwarden/jslib.git", "@bitwarden/jslib": "git+https://github.com/bitwarden/jslib.git",

View File

@ -19,10 +19,10 @@ const windowMain = new WindowMain(dev);
const messagingMain = new MessagingMain(windowMain); const messagingMain = new MessagingMain(windowMain);
const menuMain = new MenuMain(windowMain, i18nService); const menuMain = new MenuMain(windowMain, i18nService);
windowMain.init(); windowMain.init().then(() => {
messagingMain.init(); messagingMain.init();
return i18nService.init();
i18nService.init().then(() => { }).then(() => {
menuMain.init(); menuMain.init();
}, (e: any) => { }, (e: any) => {
console.log(e); console.log(e);

View File

@ -329,7 +329,7 @@ export class MenuMain {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
template[0].label = app.getName(); template[0].label = app.getName();
(template[0].submenu as MenuItemConstructorOptions[]).concat([ template[0].submenu = (template[0].submenu as MenuItemConstructorOptions[]).concat([
{ type: 'separator' }, { type: 'separator' },
{ role: 'about' }, { role: 'about' },
{ type: 'separator' }, { type: 'separator' },

View File

@ -7,12 +7,16 @@ export class WindowMain {
constructor(private dev: boolean) { } constructor(private dev: boolean) { }
init() { init(): Promise<any> {
return new Promise((resolve, reject) => {
try { try {
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.on('ready', () => this.createWindow()); app.on('ready', () => {
this.createWindow();
resolve();
});
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
@ -34,7 +38,9 @@ export class WindowMain {
} catch (e) { } catch (e) {
// Catch Error // Catch Error
// throw e; // throw e;
reject(e);
} }
});
} }
private createWindow() { private createWindow() {