-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWindow.js
executable file
·43 lines (37 loc) · 904 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
42
43
'use strict'
const { BrowserWindow } = require('electron')
// default window settings
const defaultProps = {
width: 350,
height: 400,
// show: false,
// center: true,
resizable: false,
minimizable: false,
maximizable: false,
closable: true,
fullscreenable: false,
skipTaskbar: false,
frame: false,
// transparent: true,
title: 'Clippy',
alwaysOnTop: true,
// update for electron V5+
webPreferences: {
nodeIntegration: true
}
}
class Window extends BrowserWindow {
constructor ({ file, ...windowSettings }) {
// calls new BrowserWindow with these props
super({ ...defaultProps, ...windowSettings })
// load the html and open devtools
this.loadFile(file)
// this.webContents.openDevTools()
// gracefully show when ready to prevent flickering
this.once('ready-to-show', () => {
this.show()
})
}
}
module.exports = Window