|
|
@ -1,11 +1,15 @@
|
|
|
|
// Importing modules
|
|
|
|
// Importing modules
|
|
|
|
const { app, BrowserWindow } = require('electron')
|
|
|
|
const { app, BrowserWindow } = require('electron')
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
|
|
|
|
// Reusable function to instantiate windows
|
|
|
|
// Reusable function to instantiate windows
|
|
|
|
const createWindow = () => {
|
|
|
|
const createWindow = () => {
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
width: 800,
|
|
|
|
width: 800,
|
|
|
|
height: 600,
|
|
|
|
height: 600,
|
|
|
|
|
|
|
|
webPreferences: {
|
|
|
|
|
|
|
|
preload: path.join(__dirname, 'preload.js'),
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
win.loadFile('index.html')
|
|
|
|
win.loadFile('index.html')
|
|
|
@ -17,7 +21,9 @@ app.whenReady().then(() => {
|
|
|
|
|
|
|
|
|
|
|
|
// Open a window if none are open (macos only)
|
|
|
|
// Open a window if none are open (macos only)
|
|
|
|
app.on('activate', () => {
|
|
|
|
app.on('activate', () => {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
|
|
|
|
|
|
createWindow()
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|