mirror of
https://github.com/MutableLoss/6502SimDesktop.git
synced 2024-11-28 22:49:41 +00:00
41 lines
928 B
JavaScript
41 lines
928 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
|
|
}))
|
|
|
|
if(process.platform === 'darwin') {
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(OSXtemplate));
|
|
} else if(process.platform !== 'darwin') {
|
|
BrowserWindow.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()
|
|
}
|
|
}) |