anys-web 1.1.3 → 1.3.0
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/cjs/recorder-plugin.js +10 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
- package/src/recorder-plugin.js +12 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anys-web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -16,25 +16,25 @@
|
|
|
16
16
|
},
|
|
17
17
|
"keywords": [],
|
|
18
18
|
"author": "tangshuang",
|
|
19
|
-
"license": "
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"anys": "^1.
|
|
22
|
-
"anys-shared": "^1.
|
|
21
|
+
"anys": "^1.2.0",
|
|
22
|
+
"anys-shared": "^1.2.0",
|
|
23
23
|
"anys-web-plugin-identify": "^1.1.0",
|
|
24
|
-
"anys-web-plugin-monitor-ajax": "^1.
|
|
25
|
-
"anys-web-plugin-monitor-dom-mutation": "^1.
|
|
26
|
-
"anys-web-plugin-monitor-input-event": "^1.
|
|
27
|
-
"anys-web-plugin-monitor-mouse-event": "^1.
|
|
28
|
-
"anys-web-plugin-monitor-scroll-event": "^1.
|
|
29
|
-
"anys-web-plugin-monitor-touch-event": "^1.
|
|
30
|
-
"anys-web-plugin-monitor-url": "^1.
|
|
31
|
-
"anys-web-plugin-monitor-window-activity": "^1.
|
|
32
|
-
"anys-web-plugin-monitor-window-size": "^1.
|
|
33
|
-
"anys-web-plugin-send-by-ajax": "^1.
|
|
34
|
-
"anys-web-plugin-store-offline": "^1.
|
|
24
|
+
"anys-web-plugin-monitor-ajax": "^1.2.0",
|
|
25
|
+
"anys-web-plugin-monitor-dom-mutation": "^1.2.0",
|
|
26
|
+
"anys-web-plugin-monitor-input-event": "^1.2.0",
|
|
27
|
+
"anys-web-plugin-monitor-mouse-event": "^1.2.0",
|
|
28
|
+
"anys-web-plugin-monitor-scroll-event": "^1.2.0",
|
|
29
|
+
"anys-web-plugin-monitor-touch-event": "^1.2.0",
|
|
30
|
+
"anys-web-plugin-monitor-url": "^1.2.0",
|
|
31
|
+
"anys-web-plugin-monitor-window-activity": "^1.2.0",
|
|
32
|
+
"anys-web-plugin-monitor-window-size": "^1.2.0",
|
|
33
|
+
"anys-web-plugin-send-by-ajax": "^1.3.0",
|
|
34
|
+
"anys-web-plugin-store-offline": "^1.2.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f7f933bcea2fc6061f7b80209a2f65d772081101"
|
|
40
40
|
}
|
package/src/recorder-plugin.js
CHANGED
|
@@ -26,9 +26,9 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
26
26
|
AnysMonitorScrollEventPlugin,
|
|
27
27
|
];
|
|
28
28
|
|
|
29
|
-
constructor(anys, [
|
|
29
|
+
constructor(anys, [offlineStore, urlMonitor, windowSizeMonitor, DOMMutationMonitor]) {
|
|
30
30
|
super(anys);
|
|
31
|
-
this.
|
|
31
|
+
this.offlineStore = offlineStore;
|
|
32
32
|
this.urlMonitor = urlMonitor;
|
|
33
33
|
this.windowSizeMonitor = windowSizeMonitor;
|
|
34
34
|
this.DOMMutationMonitor = DOMMutationMonitor;
|
|
@@ -73,7 +73,6 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
73
73
|
|
|
74
74
|
const timer = setInterval(() => {
|
|
75
75
|
this.anys.report();
|
|
76
|
-
this.cache = {};
|
|
77
76
|
}, this.anys.options.reportInterval);
|
|
78
77
|
|
|
79
78
|
let isUnloaded = 0;
|
|
@@ -86,7 +85,7 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
86
85
|
const ids = Object.keys(this.cache);
|
|
87
86
|
const logs = Object.values(this.cache);
|
|
88
87
|
if (ids.length) {
|
|
89
|
-
this.
|
|
88
|
+
this.offlineStore.remove(ids); // async may not executed
|
|
90
89
|
navigator.sendBeacon(this.anys.options.reportUrl, JSON.stringify(logs));
|
|
91
90
|
this.cache = {};
|
|
92
91
|
}
|
|
@@ -115,7 +114,7 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
115
114
|
* @returns
|
|
116
115
|
*/
|
|
117
116
|
read(message) {
|
|
118
|
-
return this.
|
|
117
|
+
return this.offlineStore.read(message);
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
send(logs) {
|
|
@@ -130,7 +129,7 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
130
129
|
}
|
|
131
130
|
});
|
|
132
131
|
|
|
133
|
-
groups.
|
|
132
|
+
const defers = groups.map((data) => {
|
|
134
133
|
const items = [];
|
|
135
134
|
const ids = [];
|
|
136
135
|
|
|
@@ -146,13 +145,18 @@ export class AnysRecorderPlugin extends AnysPlugin {
|
|
|
146
145
|
|
|
147
146
|
const { reportUrl, reportParams } = this.anys.options;
|
|
148
147
|
const url = reportParams ? replaceUrlSearch(reportUrl, reportParams) : reportUrl;
|
|
149
|
-
ajaxPost(url, items).then(() => {
|
|
150
|
-
this.offlineLogger.remove(ids);
|
|
148
|
+
return ajaxPost(url, items).then(() => {
|
|
151
149
|
ids.forEach((id) => {
|
|
152
150
|
delete this.cache[id];
|
|
153
151
|
});
|
|
154
152
|
});
|
|
155
153
|
});
|
|
154
|
+
|
|
155
|
+
return Promise.all(defers);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
clear() {
|
|
159
|
+
this.cache = {};
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
auth(info) {
|