init
This commit is contained in:
33
src/main/app.ts
Normal file
33
src/main/app.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
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()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user