Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
use setApplicationMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
simon300000 committed Oct 14, 2019
1 parent 654a36f commit cb1e900
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions electron/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, ipcMain, nativeImage } from 'electron';
import { app, BrowserWindow, ipcMain, nativeImage, Menu } from 'electron';
import * as request from 'request';
import * as fs from 'fs';
import { join } from 'path';
Expand Down Expand Up @@ -44,7 +44,12 @@ const createMainWindow = (): BrowserWindow => {
// win.loadURL('http://localhost:4200');
// win.webContents.openDevTools();
win.loadURL(`file://${__dirname}/../../app/index.html`);
win.setMenu(createMainWinMenu(app, playerObjMap));
const menu = createMainWinMenu(app, playerObjMap);
if (process.platform === 'darwin') {
Menu.setApplicationMenu(menu);
} else {
win.setMenu(menu);
}
win.on('close', () => {
playerObjMap.forEach((playerObj: PlayerObj) => {
playerObj.playerWin.close();
Expand Down

0 comments on commit cb1e900

Please sign in to comment.