forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
59 lines (45 loc) · 1.56 KB
/
Copy pathindex.ts
File metadata and controls
59 lines (45 loc) · 1.56 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
/**
* Copyright (c) 2021 Hengyang Zhang
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { trySendMsg2Tab } from "@api/chrome/tab"
import { initBrowserAction, initSidePanel } from './action'
import badgeTextManager from "./badge-manager"
import initCsHandler from "./content-script-handler"
import initDataCleaner from "./data-cleaner"
import { initAfterInstalled } from './install-handler'
import initLimitProcessor from "./limit-processor"
import MessageDispatcher from "./message-dispatcher"
import { initScheduler } from './scheduler'
import TabListener from './tab-listener'
import initTrackServer from "./track-server"
import initWhitelistMenuManager from "./whitelist-menu-manager"
initAfterInstalled()
// Initialize side panel
initSidePanel()
// Initialize context menu and icon action
initBrowserAction()
// Init data cleaner
initDataCleaner()
const messageDispatcher = new MessageDispatcher()
// Limit processor
initLimitProcessor(messageDispatcher)
// Content-script's request handler
initCsHandler(messageDispatcher)
// Start server
initTrackServer(messageDispatcher)
// scheduler
initScheduler()
// Manage the context menus
initWhitelistMenuManager()
// Badge manager
badgeTextManager.init(messageDispatcher)
// Listen to tab changed
new TabListener()
.onActivated(({ url, tabId }) => badgeTextManager.updateFocus({ url, tabId }))
.onUpdated((tabId, { audible }) => audible !== undefined && trySendMsg2Tab(tabId, 'syncAudible', audible))
.start()
// Start message dispatcher
messageDispatcher.start()