You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.1 KiB
69 lines
1.1 KiB
const { app, BrowserWindow } = require('electron')
|
|
const path = require('path')
|
|
|
|
// add var for window
|
|
let appWindow = null
|
|
|
|
// add events
|
|
app.on('ready', handleReady)
|
|
app.on('activate', handleActivate)
|
|
app.on('window-all-closed', handleAllClosed)
|
|
|
|
/**
|
|
* create window for app
|
|
*
|
|
*
|
|
*/
|
|
function handleReady() {
|
|
|
|
// create window
|
|
appWindow = new BrowserWindow({
|
|
frame: false,
|
|
webPreferences: {
|
|
nodeIntegration: true,
|
|
nodeIntegrationInWorker: true,
|
|
contextIsolation: false
|
|
}
|
|
})
|
|
|
|
// max size of window
|
|
appWindow.maximize()
|
|
appWindow.setMenu(null)
|
|
|
|
// loading
|
|
appWindow.loadURL('file://' + __dirname + '/dist/index.html')
|
|
|
|
// add event if window closed
|
|
appWindow.on('closed', handleClose)
|
|
|
|
// @TODO only for
|
|
appWindow.webContents.openDevTools()
|
|
}
|
|
|
|
/**
|
|
* handle close window
|
|
*
|
|
*/
|
|
function handleClose() {
|
|
appWindow = null
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
*/
|
|
function handleAllClosed() {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
*/
|
|
function handleActivate() {
|
|
if (appWindow === null) {
|
|
createAppWindow()
|
|
}
|
|
} |