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: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",

View File

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

View File

@ -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' },

View File

@ -7,12 +7,16 @@ export class WindowMain {
constructor(private dev: boolean) { }
init() {
init(): Promise<any> {
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());
app.on('ready', () => {
this.createWindow();
resolve();
});
// Quit when all windows are closed.
app.on('window-all-closed', () => {
@ -34,7 +38,9 @@ export class WindowMain {
} catch (e) {
// Catch Error
// throw e;
reject(e);
}
});
}
private createWindow() {