-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.js
41 lines (34 loc) · 850 Bytes
/
window.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
const BrowserWindow =
require("electron").BrowserWindow || require("electron").remote.BrowserWindow;
const os = require("os") || require("electron").remote.require("os");
const isMac = os.platform() === "darwin";
const winOption = {
width: 1100,
height: 768,
minWidth: 522,
minHeight: 400,
frame: isMac,
};
function createWindow(opts = {}) {
const win = new BrowserWindow(
Object.assign({}, winOption, {
titleBarStyle: "hidden",
webPreferences: {
contextisolation: true,
},
})
);
if (opts.hasOwnProperty("url")) {
win.loadURL(opts.url);
}
win.on("enter-full-screen", (event) => {
win.webContents.send("enter-full-screen");
});
win.on("leave-full-screen", (event) => {
win.webContents.send("leave-full-screen");
});
return win;
}
module.exports = {
createWindow,
};