mirror of
https://github.com/MutableLoss/6502SimDesktop.git
synced 2024-11-21 22:32:13 +00:00
43 lines
968 B
JavaScript
43 lines
968 B
JavaScript
const {app, Menu, BrowserWindow} = require('electron')
|
|
|
|
const path = require('path')
|
|
const url = require('url')
|
|
|
|
const { OSXtemplate, PCtemplate } = require('./app/electron/menu')
|
|
let mainWindow
|
|
|
|
function createWindow () {
|
|
mainWindow = new BrowserWindow({width: 700, height: 600})
|
|
|
|
mainWindow.loadURL(url.format({
|
|
pathname: path.join(__dirname, 'app/index.html'),
|
|
protocol: 'file:',
|
|
slashes: true
|
|
}))
|
|
// mainWindow.webContents.openDevTools()
|
|
|
|
if(process.platform === 'darwin') {
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(OSXtemplate))
|
|
} else if(process.platform !== 'darwin') {
|
|
mainWindow.setMenu(Menu.buildFromTemplate(PCtemplate))
|
|
}
|
|
|
|
mainWindow.on('closed', function () {
|
|
mainWindow = null
|
|
})
|
|
}
|
|
|
|
app.on('ready', createWindow)
|
|
|
|
app.on('window-all-closed', function () {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
})
|
|
|
|
app.on('activate', function () {
|
|
if (mainWindow === null) {
|
|
createWindow()
|
|
}
|
|
})
|