-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathchrome.js
46 lines (41 loc) · 1.16 KB
/
chrome.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
const electron = require('electron');
const url = require('url');
const path = require('path');
const BrowserWindow = electron.BrowserWindow;
/**
* Top level chrome module which creates the main Electron BrowserWindow and
* loads the system chrome inside it.
*/
var Chrome = {
/**
* Create main window and load shell as system chrome.
*/
start: function() {
// Create the main window
this.mainWindow = new BrowserWindow({
fullscreen: true,
webPreferences: {
nodeIntegration: true,
webviewTag: true
}
});
// Load shell.html as chrome
this.mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'chrome/shell.html'),
protocol: 'file:',
slashes: true
}));
// Uncomment the following line to open DevTools
//this.mainWindow.webContents.openDevTools();
},
/**
* Send a message to the system chrome over IPC.
*
* @param String channel The channel over which to send the message.
* @param String message The message to send.
*/
sendMessage: function(channel, message){
this.mainWindow.webContents.send(channel, message);
}
}
module.exports = Chrome;