-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
21 lines (17 loc) · 617 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const electron = require('electron')
const {app, BrowserWindow} = electron
const fs = require('fs')
let win
app.on('ready', () => {
const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize
let maps = readConfig('./maps.json')
let m = maps["whistler"]
win = new BrowserWindow({width, height})
win.loadURL(`file://${__dirname}/maptest_fullscreen.html?m=${encodeURI(JSON.stringify(m))}`)
win.on('closed', () => win = null)
})
function readConfig(configPath) {
let result = fs.readFileSync(configPath, 'utf8')
return JSON.parse(result);
}
app.on('window-all-closed', () => app.quit())