-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (32 loc) · 791 Bytes
/
app.js
File metadata and controls
40 lines (32 loc) · 791 Bytes
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
const { browse } = require('./network.js');
const { app, ipcMain, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url');
let win;
function loadURL() {
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
}
function createWindow() {
win = new BrowserWindow({
width: 1024,
height: 768,
webPreferences: {
nodeIntegration: true
}
});
loadURL();
// win.webContents.openDevTools();
}
ipcMain.on('urlRequest', (e, url) => {
console.log('ipcMain on urlRequest', url);
try{
browse(url, loadURL);
} catch(e) {
console.log(e.message);
}
});
app.on('ready', createWindow);