@summalytics/js 0.1.1 → 0.1.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.cjs +0 -8
- package/dist/index.js +0 -8
- package/package.json +1 -1
- package/src/index.ts +0 -9
package/dist/index.cjs
CHANGED
|
@@ -59,14 +59,6 @@ function createSummalytics(config) {
|
|
|
59
59
|
const endpoint = (_a = config.endpoint) != null ? _a : DEFAULT_ENDPOINT;
|
|
60
60
|
const send = async (payload) => {
|
|
61
61
|
const body = JSON.stringify(payload);
|
|
62
|
-
if (typeof navigator !== "undefined" && navigator.sendBeacon) {
|
|
63
|
-
const beaconUrl = `${endpoint}${endpoint.includes("?") ? "&" : "?"}key=${encodeURIComponent(config.writeKey)}`;
|
|
64
|
-
const blob = new Blob([body], { type: "application/json" });
|
|
65
|
-
const accepted = navigator.sendBeacon(beaconUrl, blob);
|
|
66
|
-
if (accepted) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
62
|
await fetch(endpoint, {
|
|
71
63
|
method: "POST",
|
|
72
64
|
headers: {
|
package/dist/index.js
CHANGED
|
@@ -38,14 +38,6 @@ function createSummalytics(config) {
|
|
|
38
38
|
const endpoint = (_a = config.endpoint) != null ? _a : DEFAULT_ENDPOINT;
|
|
39
39
|
const send = async (payload) => {
|
|
40
40
|
const body = JSON.stringify(payload);
|
|
41
|
-
if (typeof navigator !== "undefined" && navigator.sendBeacon) {
|
|
42
|
-
const beaconUrl = `${endpoint}${endpoint.includes("?") ? "&" : "?"}key=${encodeURIComponent(config.writeKey)}`;
|
|
43
|
-
const blob = new Blob([body], { type: "application/json" });
|
|
44
|
-
const accepted = navigator.sendBeacon(beaconUrl, blob);
|
|
45
|
-
if (accepted) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
41
|
await fetch(endpoint, {
|
|
50
42
|
method: "POST",
|
|
51
43
|
headers: {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -39,15 +39,6 @@ export function createSummalytics(config: SummalyticsConfig) {
|
|
|
39
39
|
const send = async (payload: Record<string, unknown>) => {
|
|
40
40
|
const body = JSON.stringify(payload)
|
|
41
41
|
|
|
42
|
-
if (typeof navigator !== 'undefined' && navigator.sendBeacon) {
|
|
43
|
-
const beaconUrl = `${endpoint}${endpoint.includes('?') ? '&' : '?'}key=${encodeURIComponent(config.writeKey)}`
|
|
44
|
-
const blob = new Blob([body], { type: 'application/json' })
|
|
45
|
-
const accepted = navigator.sendBeacon(beaconUrl, blob)
|
|
46
|
-
if (accepted) {
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
42
|
await fetch(endpoint, {
|
|
52
43
|
method: 'POST',
|
|
53
44
|
headers: {
|