Repository navigation
Expand file tree
/
Copy pathbackground-process.js
More file actions
70 lines (55 loc) · 1.98 KB
/
Copy pathbackground-process.js
File metadata and controls
70 lines (55 loc) · 1.98 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This is main process of Electron, started as first thing when your
// app starts. This script is running through entire life of your application.
// It doesn't have any windows which you can see on screen, but we can open
// window from here.
import { app, Menu } from 'electron'
import log from 'loglevel'
import env from './env'
import * as beakerBrowser from './background-process/browser'
import * as plugins from './background-process/plugins'
import * as webAPIs from './background-process/web-apis'
import * as windows from './background-process/ui/windows'
import buildWindowMenu from './background-process/ui/window-menu'
import registerContextMenu from './background-process/ui/context-menu'
import * as downloads from './background-process/ui/downloads'
import * as settings from './background-process/dbs/settings'
import * as sitedata from './background-process/dbs/sitedata'
import * as bookmarks from './background-process/dbs/bookmarks'
import * as history from './background-process/dbs/history'
import * as beakerProtocol from './background-process/protocols/beaker'
import * as beakerFaviconProtocol from './background-process/protocols/beaker-favicon'
import * as openURL from './background-process/open-url'
// configure logging
log.setLevel('trace')
// load the installed protocols
plugins.registerStandardSchemes()
app.on('ready', function () {
// databases
settings.setup()
sitedata.setup()
bookmarks.setup()
history.setup()
// base
beakerBrowser.setup()
// ui
Menu.setApplicationMenu(Menu.buildFromTemplate(buildWindowMenu(env)))
registerContextMenu()
windows.setup()
downloads.setup()
// protocols
beakerProtocol.setup()
beakerFaviconProtocol.setup()
plugins.setupProtocolHandlers()
// web APIs
webAPIs.setup()
plugins.setupWebAPIs()
// listen OSX open-url event
openURL.setup()
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin')
app.quit()
})
app.on('open-url', function (e, url) {
openURL.open(url)
})