/
core.coffee
57 lines (52 loc) · 1.04 KB
/
core.coffee
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
54
55
56
57
###*
* @fileoverview メイン
###
{app, session, BrowserWindow} = require "electron"
path = require "path"
config = require "./config"
cache = require "./cache"
mainWindow = null
###*
* ウィンドウを作成
###
createWindow = ->
mainWindow = new BrowserWindow(
width: 800,
height: 600,
title: "BlitzModderPC",
icon: path.join(app.getAppPath(), "gui/img/image.jpg"),
autoHideMenuBar: true,
show: false
)
mainWindow.once("ready-to-show", ->
mainWindow.show()
return
)
mainWindow.loadURL("file://#{app.getAppPath()}/gui/index.html")
mainWindow.on("closed", ->
# guiの終了
mainWindow = null
return
)
return
###*
* 起動準備完了
###
app.on("ready", ->
# 設定とキャッシュの準備待ち
Promise.all([config.init(), cache.init()]).then( ->
createWindow()
return
).catch((err) ->
console.error err
return
)
)
app.on("window-all-closed", ->
# キャッシュ削除
session.defaultSession.clearCache( ->
# アプリ終了
app.quit()
)
return
)