34 lines
770 B
JavaScript
34 lines
770 B
JavaScript
const { app, BrowserWindow, dialog, ipcMain } = require('electron')
|
|
require('@electron/remote/main').initialize()
|
|
const path = require('path')
|
|
|
|
function createWindow () {
|
|
const win = new BrowserWindow({
|
|
width: 800,
|
|
height: 600,
|
|
webPreferences: {
|
|
nodeIntegration: true,
|
|
enableRemoteModule: true,
|
|
contextIsolation: false,
|
|
devTools: true,
|
|
preload: path.join(__dirname, 'init.js')
|
|
}
|
|
})
|
|
win.webContents.openDevTools()
|
|
win.maximize();
|
|
win.loadFile('main.html')
|
|
}
|
|
|
|
|
|
app.on('window-all-closed', function () {
|
|
if (process.platform !== 'darwin') app.quit()
|
|
})
|
|
|
|
|
|
app.whenReady().then(() => {
|
|
createWindow()
|
|
app.on('activate', function () {
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
})
|
|
})
|