@zjlab-fe/util 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/types/browser-logger.d.ts +25 -23
- package/package.json +1 -1
- package/test.html +4 -0
|
@@ -44,48 +44,50 @@ export declare class BrowserLogger {
|
|
|
44
44
|
pid: string;
|
|
45
45
|
uid?: string;
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
currentLocationPath: string;
|
|
55
|
-
canSendTTI: boolean;
|
|
56
|
-
pvId: string;
|
|
57
|
-
systemInfo: {
|
|
58
|
-
detector_browser: string;
|
|
59
|
-
detector_browser_version: string;
|
|
60
|
-
detector_device: string;
|
|
61
|
-
detector_os: string;
|
|
62
|
-
detector_os_version: string;
|
|
63
|
-
http_user_agent: string;
|
|
64
|
-
};
|
|
47
|
+
private dataQueue;
|
|
48
|
+
private performanceData;
|
|
49
|
+
private currentLocationPath;
|
|
50
|
+
private canSendTTI;
|
|
51
|
+
private pvId;
|
|
52
|
+
private systemInfo;
|
|
65
53
|
constructor(config: {
|
|
66
54
|
pid: string;
|
|
67
55
|
uid?: string;
|
|
68
56
|
});
|
|
69
|
-
reSendPV
|
|
70
|
-
init
|
|
57
|
+
private reSendPV;
|
|
58
|
+
private init;
|
|
71
59
|
static singleton(config: {
|
|
72
60
|
pid: string;
|
|
73
61
|
uid?: string;
|
|
74
62
|
}): BrowserLogger;
|
|
75
|
-
sendPV
|
|
63
|
+
private sendPV;
|
|
76
64
|
logAPI(apiData: RequestData): void;
|
|
77
65
|
logError(error: FormattedError): void;
|
|
78
66
|
/**
|
|
79
67
|
* 可交互打点
|
|
80
68
|
*/
|
|
81
69
|
logTTI(): void;
|
|
82
|
-
|
|
70
|
+
/**
|
|
71
|
+
* 设置配置
|
|
72
|
+
* @param config
|
|
73
|
+
*/
|
|
74
|
+
setConfig(config: {
|
|
75
|
+
pid?: string;
|
|
76
|
+
uid?: string;
|
|
77
|
+
}): void;
|
|
78
|
+
/**
|
|
79
|
+
* 开始发送埋点日志
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
start(): void;
|
|
83
|
+
private innerSendLog;
|
|
84
|
+
private realSendLog;
|
|
83
85
|
/**
|
|
84
86
|
* 自定义打点
|
|
85
87
|
* @param spm spm 路径
|
|
86
88
|
* @param type 事件类型
|
|
87
89
|
* @param data 额外数据
|
|
88
90
|
*/
|
|
89
|
-
sendLog
|
|
91
|
+
private sendLog;
|
|
90
92
|
}
|
|
91
93
|
export {};
|
package/package.json
CHANGED
package/test.html
CHANGED
|
@@ -15,12 +15,16 @@
|
|
|
15
15
|
<script>
|
|
16
16
|
const logger = ZJLabFeUtil.BrowserLogger.singleton({ pid: '123456' });
|
|
17
17
|
console.log(logger);
|
|
18
|
+
// throw new Error('xxxxxxxxxxxx')
|
|
18
19
|
setTimeout(() => {
|
|
19
20
|
document.getElementById('root').innerHTML = 'hello world';
|
|
20
21
|
logger.logTTI();
|
|
21
22
|
logger.sendLog('123456', 'click', {
|
|
22
23
|
target: 'button',
|
|
23
24
|
});
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
logger.start();
|
|
27
|
+
}, 5000);
|
|
24
28
|
}, 100);
|
|
25
29
|
</script>
|
|
26
30
|
</body>
|