-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
53 lines (47 loc) · 1.2 KB
/
app.js
File metadata and controls
53 lines (47 loc) · 1.2 KB
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
47
48
49
50
51
52
53
const {app, BrowserWindow} = require('electron') // http://electron.atom.io/docs/api
// Set up command-line switches and their defaults
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv))
.option('width', {
alias: 'w',
default: 1024,
description: 'Browser window width'
})
.option('height', {
alias: 'h',
default: 768,
description: 'Browser window height'
})
.option('url', {
alias: 'u',
default: "http://mmto.org",
description: "URL to view"
})
.argv
let window = null
// Wait until the app is ready
app.once('ready', () => {
// Create a new window
window = new BrowserWindow({
width: Number(argv.width),
height: Number(argv.height),
// Don't show the window until it ready, this prevents any white flickering
show: false,
webPreferences: {
// Disable node integration in remote page
nodeIntegration: false
}
})
const url = argv.url
window.loadURL(url)
// Show window when page is ready
window.once('ready-to-show', () => {
window.show()
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})