refactor(menu): better error handling

This commit is contained in:
4gray committed 2022-12-26 17:26:34 +01:00
1 parent b336680ec9
commit 342a549e0c
1 file changed
+23 -10
+23 -10
View File
@@ -51,15 +51,20 @@ export class AppMenu {
submenu: [
{
label: 'Add playlist',
click: () =>
this.window.webContents.send(VIEW_ADD_PLAYLIST),
click: () => {
if (!this.window.isDestroyed())
this.window.webContents.send(VIEW_ADD_PLAYLIST);
},
},
{
type: 'separator',
},
{
label: 'Settings',
click: () => this.window.webContents.send(VIEW_SETTINGS),
click: () => {
if (!this.window.isDestroyed())
this.window.webContents.send(VIEW_SETTINGS);
},
},
{
type: 'separator',
@@ -82,25 +87,33 @@ export class AppMenu {
submenu: [
{
label: 'What is new',
click: () => this.window.webContents.send(SHOW_WHATS_NEW),
click: () => {
if (!this.window.isDestroyed())
this.window.webContents.send(SHOW_WHATS_NEW);
},
},
{
label: 'Report a bug',
click: () =>
click: () => {
shell.openExternal(
'https://github.com/4gray/iptvnator'
),
);
},
},
{
label: 'Buy me a coffee',
click: () =>
click: () => {
shell.openExternal(
'https://www.buymeacoffee.com/4gray'
),
);
},
},
{
label: 'Open DevTools',
click: () => this.window.webContents.openDevTools(),
click: () => {
if (!this.window.isDestroyed())
this.window.webContents.openDevTools();
},
},
{
type: 'separator',
@@ -114,7 +127,7 @@ export class AppMenu {
'../dist/assets/icons/icon.png'
),
copyright: 'Copyright (c) 2020-2022 4gray',
package_json_dir: __dirname,
package_json_dir: path.join(__dirname, '../'),
}),
},
],