mirror of
https://github.com/bitwarden/desktop.git
synced 2024-12-27 17:08:07 +01:00
init menu after app ready
This commit is contained in:
parent
214d8f7ae8
commit
884eefd589
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -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' },
|
||||
|
@ -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<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();
|
||||
}
|
||||
});
|
||||
|
||||
} 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() {
|
||||
|
Loading…
Reference in New Issue
Block a user