33 lines
649 B
TypeScript
33 lines
649 B
TypeScript
|
|
import { app, BrowserWindow } from 'electron'
|
||
|
|
|
||
|
|
function createWindow() {
|
||
|
|
const win = new BrowserWindow({
|
||
|
|
width: 800,
|
||
|
|
height: 600,
|
||
|
|
webPreferences: {
|
||
|
|
nodeIntegration: true
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
if (process.env.NODE_ENV === 'development') {
|
||
|
|
win.loadURL('http://localhost:3000/')
|
||
|
|
} else {
|
||
|
|
win.loadFile('dist/render/index.html')
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
app.whenReady().then(createWindow)
|
||
|
|
|
||
|
|
app.on('window-all-closed', () => {
|
||
|
|
if (process.platform !== 'darwin') {
|
||
|
|
app.quit()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
app.on('activate', () => {
|
||
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||
|
|
createWindow()
|
||
|
|
}
|
||
|
|
})
|