-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathwindow.js
More file actions
40 lines (33 loc) · 833 Bytes
/
window.js
File metadata and controls
40 lines (33 loc) · 833 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 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
}