-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.ts
117 lines (81 loc) · 1.85 KB
/
index.ts
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { SendType } from '../shatter_error/types/sendType'
type CANCEL = null | undefined | boolean
export interface InitOptions extends BlockEventTypes, HooksTypes {
/**
* dsn服务器地址
*/
dsn: string
/**
* 唯一key
*/
appkey: string
/**
* 默认关闭,打印调试信息
*/
debug?: boolean
/**
* 仅使用创建 img 标签方式打点
*/
onlyImg?: boolean
/**
* 默认20,最大100
*/
//maxBreadcrumbs?: number
/**
* 使用的 shatter monitor
*/
usage?: string | string[]
}
export interface HooksTypes {
/**
* 钩子函数,在每次发送事件前会调用
*
* @params params 发送参数
*
* ps: 如果返回 false 时,将忽略本次上传
*/
beforeSendData?(params: SendType): boolean | Event | PromiseLike<Event> | CANCEL
}
export interface BlockEventSingleTypes{
/**
* 禁止上传 console.error 信息
*/
blockConsole?: boolean
/**
* 禁止上传 Unhandledrejection 信息
*/
blockPromise?: boolean
/**
* 禁止上传 error 事件
*/
blockError?: boolean
/**
* 禁止上传资源加载信息
*/
blockSource?: boolean
/**
* 禁止上传 xhr 信息
*/
blockXhr?: boolean
/**
* 禁止上传 fetch 信息
*/
blockFetch?: boolean
/**
* 禁止全局 addeventlistener 使用 try...catch
*/
blockTry?: boolean
}
export interface BlockEventTypes extends BlockEventSingleTypes{
/**
* 禁止上传所有 xhr 信息
*/
blockHttpRequest?: boolean
/**
* 仅上传 xhr 信息,禁止对其他原生事件监听及处理
*/
onlyHttpRequest?: boolean
}
export interface HooksClassType {
options: InitOptions
}