forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmq.d.ts
More file actions
67 lines (65 loc) · 1.49 KB
/
mq.d.ts
File metadata and controls
67 lines (65 loc) · 1.49 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
/**
* Message queue
*/
declare namespace timer.mq {
type ReqCode =
| 'openLimitPage'
| 'limitTimeMeet'
// @since 0.9.0
| 'limitWaking'
// @since 1.2.3
| 'limitChanged'
// @since 3.1.0
| 'limitReminder'
// @since 2.0.0
| 'askVisitTime'
| 'askHitVisit'
// @since 3.2.0
| 'siteRunChange'
// @since 3.5.0
| "enableTabGroup"
// Request by content script
// @since 1.3.0
| "cs.isInWhitelist"
| "cs.incVisitCount"
| "cs.printTodayInfo"
| "cs.getTodayInfo"
| "cs.moreMinutes"
| "cs.getLimitedRules"
| "cs.getRelatedRules"
| "cs.trackTime"
| "cs.trackRunTime"
| "cs.onInjected"
| "cs.openAnalysis"
| "cs.openLimit"
// @since 2.5.5
| "cs.idleChange"
// @since 3.2.0
| "cs.getRunSites"
// @since 3.6.1
| "cs.timelineEv"
type ResCode = "success" | "fail" | "ignore"
/**
* @since 0.2.2
*/
type Request<T = any> = {
code: ReqCode
data?: T
}
/**
* @since 0.8.4
*/
type Response<T = any> = {
code: ResCode,
msg?: string
data?: T
}
/**
* @since 1.3.0
*/
type Handler<Req, Res> = (data: Req, sender: chrome.runtime.MessageSender) => Promise<Res> | Res
/**
* @since 0.8.4
*/
type Callback<T = any> = (result?: Response<T>) => void
}