-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (23 loc) · 931 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { app, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url'); // url native package from node. Electron suggests that you use this package so it's more safe
// Menu
const menu = require('./src/utils/menu');
if (!app.isPackaged) {
require('electron-reload')(__dirname); // You can say here if you not only want to watch windows, and you want, like, processes
}
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
title: 'Paquirri Bot'
}); // This creates a new window
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, '/src', 'index.html'), // what file to show, using his path
protocol: 'file',
slashes: true // Loading like address of navegator
}));
mainWindow.setMenu(menu); // Menu.setApplicationMenu(mainMenu);
mainWindow.on('closed', () => {
app.quit();
});
});