@tracelog/lib 0.0.6 → 0.0.7
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.
|
@@ -110,7 +110,8 @@ class SenderManager extends state_manager_1.StateManager {
|
|
|
110
110
|
}
|
|
111
111
|
sendQueueSync(body) {
|
|
112
112
|
const { url, payload } = this.prepareRequest(body);
|
|
113
|
-
|
|
113
|
+
const blob = new Blob([payload], { type: 'application/json' });
|
|
114
|
+
if (this.isSendBeaconAvailable() && navigator.sendBeacon(url, blob)) {
|
|
114
115
|
return true;
|
|
115
116
|
}
|
|
116
117
|
return this.sendSyncXHR(url, payload);
|
|
@@ -120,7 +121,8 @@ class SenderManager extends state_manager_1.StateManager {
|
|
|
120
121
|
return false;
|
|
121
122
|
}
|
|
122
123
|
const { url, payload } = this.prepareRequest(body);
|
|
123
|
-
|
|
124
|
+
const blob = new Blob([payload], { type: 'application/json' });
|
|
125
|
+
return navigator.sendBeacon(url, blob);
|
|
124
126
|
}
|
|
125
127
|
sendSyncXHR(url, payload) {
|
|
126
128
|
const xhr = new XMLHttpRequest();
|
|
@@ -107,7 +107,8 @@ export class SenderManager extends StateManager {
|
|
|
107
107
|
}
|
|
108
108
|
sendQueueSync(body) {
|
|
109
109
|
const { url, payload } = this.prepareRequest(body);
|
|
110
|
-
|
|
110
|
+
const blob = new Blob([payload], { type: 'application/json' });
|
|
111
|
+
if (this.isSendBeaconAvailable() && navigator.sendBeacon(url, blob)) {
|
|
111
112
|
return true;
|
|
112
113
|
}
|
|
113
114
|
return this.sendSyncXHR(url, payload);
|
|
@@ -117,7 +118,8 @@ export class SenderManager extends StateManager {
|
|
|
117
118
|
return false;
|
|
118
119
|
}
|
|
119
120
|
const { url, payload } = this.prepareRequest(body);
|
|
120
|
-
|
|
121
|
+
const blob = new Blob([payload], { type: 'application/json' });
|
|
122
|
+
return navigator.sendBeacon(url, blob);
|
|
121
123
|
}
|
|
122
124
|
sendSyncXHR(url, payload) {
|
|
123
125
|
const xhr = new XMLHttpRequest();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tracelog/lib",
|
|
3
3
|
"description": "JavaScript library for web analytics and real-time event tracking",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"main": "./dist/cjs/public-api.js",
|
|
7
7
|
"module": "./dist/esm/public-api.js",
|
|
8
8
|
"types": "./dist/esm/public-api.d.ts",
|