-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.js
52 lines (42 loc) · 1.17 KB
/
main.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
44
45
46
47
48
49
50
51
52
var app = require('app') // Module to control application life.
var BrowserWindow = require('browser-window') // Module to create native browser window.
var ipc = require('ipc')
var frame = process.platform === 'win32'
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function () {
// Create the browser window.
win = new BrowserWindow({
title: 'Fastcast',
width: 800,
height: 600,
frame: frame,
'web-preferences': {
'overlay-scrollbars': true
}
})
// and load the index.html of the app.
win.loadUrl('file://' + __dirname + '/index.html')
ipc.on('close', function () {
app.quit()
})
ipc.on('minimize', function () {
win.minimize()
})
ipc.on('maximize', function () {
win.maximize()
})
ipc.on('resize', function (e, message) {
if (win.isMaximized()) return
var wid = win.getSize()[0]
var hei = (wid / message.ratio) | 0
win.setSize(wid, hei)
})
ipc.on('enter-full-screen', function () {
win.setFullScreen(true)
})
ipc.on('exit-full-screen', function () {
win.setFullScreen(false)
win.show()
})
})