-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
49 lines (41 loc) · 1.26 KB
/
main.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Modules to control application life and create native browser window
// import dotenv from 'dotenv';
// import { app, BrowserWindow } from 'electron';
// import prepareNext from 'electron-next';
// import isDev from 'electron-is-dev';
const dotenv = require('dotenv');
const { app, BrowserWindow } = require('electron');
const prepareNext = require('electron-next');
const isDev = require('electron-is-dev');
dotenv.config();
const localPort = process.env.PORT || 8000;
//const path = require('path')
/*****init your code******/
/*
delete this part
of the code
and insert your
codes from that point.
*/
/*****end your code******/
function createWindow() {
const mainWindow = new BrowserWindow({
"width": 550,
"height": 640,
"webPreferences": {
//"preload": path.join(__dirname, 'preload.js'),
"nodeIntegration": false,
"devTools": true //devtools of chrome
}
})
mainWindow.setMenuBarVisibility(false); //top bar of chrome
const devPath = `http://localhost:${localPort}/`
const entry = isDev ? devPath : __dirname + '/renderer/out/index.html'
console.log(entry)
mainWindow.loadURL(entry)
}
app.on('ready', async () => {
await prepareNext(__dirname + '/renderer')
createWindow()
console.log('create window')
})