Skip to content

Commit b1b9dd0

Browse files
committed
cleanup script
1 parent cae8032 commit b1b9dd0

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

apps/dashboard/public/databuddy.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,13 @@
340340
this.maxScrollDepth = Math.max(this.maxScrollDepth, scrollPercent);
341341
}
342342

343-
async send(event) {
343+
send(event) {
344344
const eventData =
345345
event.type === 'track' && event.payload ? event.payload : event;
346346

347347
if (
348348
this.options.disabled ||
349+
!this.options.clientId ||
349350
(this.options.filter && !this.options.filter(eventData))
350351
) {
351352
return Promise.resolve();
@@ -419,14 +420,15 @@
419420
this.send(originalEvent);
420421
}
421422
} else {
423+
//
422424
}
423425

424426
return null;
425427
}
426428
}
427429

428-
async sendBatchBeacon(events) {
429-
if (this.isServer() || !navigator.sendBeacon) {
430+
sendBatchBeacon(events) {
431+
if (this.isServer() || !navigator.sendBeacon || !this.options.clientId) {
430432
return null;
431433
}
432434

@@ -445,7 +447,9 @@
445447
if (success) {
446448
return { success: true };
447449
}
448-
} catch (_e) {}
450+
} catch (_e) {
451+
//
452+
}
449453

450454
return null;
451455
}
@@ -525,7 +529,7 @@
525529
return this.send(payload);
526530
}
527531

528-
async sendBeacon(event) {
532+
sendBeacon(event) {
529533
if (this.isServer()) {
530534
return null;
531535
}
@@ -536,6 +540,7 @@
536540

537541
if (
538542
this.options.disabled ||
543+
!this.options.clientId ||
539544
(this.options.filter && !this.options.filter(eventData))
540545
) {
541546
return null;
@@ -565,7 +570,9 @@
565570
if (success) {
566571
return { success: true };
567572
}
568-
} catch (_e) {}
573+
} catch (_e) {
574+
//
575+
}
569576
}
570577

571578
return null;
@@ -720,7 +727,9 @@
720727
if (linkUrl.origin === window.location.origin) {
721728
this.isInternalNavigation = true;
722729
}
723-
} catch (_err) {}
730+
} catch (_err) {
731+
//
732+
}
724733
}
725734
});
726735

@@ -873,7 +882,9 @@
873882
observer.observe({ type, buffered: true });
874883
this.webVitalObservers.push(observer);
875884
}
876-
} catch (_e) {}
885+
} catch (_e) {
886+
//
887+
}
877888
};
878889

879890
observe('paint', (entries) => {
@@ -933,7 +944,9 @@
933944
});
934945

935946
this.webVitalsReportTimeoutId = setTimeout(report, 10_000);
936-
} catch (_e) {}
947+
} catch (_e) {
948+
//
949+
}
937950
}
938951

939952
getConnectionInfo() {
@@ -1086,7 +1099,9 @@
10861099
if (beaconResult) {
10871100
return beaconResult;
10881101
}
1089-
} catch (_e) {}
1102+
} catch (_e) {
1103+
//
1104+
}
10901105

10911106
return this.send(errorEvent);
10921107
}
@@ -1125,7 +1140,9 @@
11251140
if (beaconResult) {
11261141
return beaconResult;
11271142
}
1128-
} catch (_e) {}
1143+
} catch (_e) {
1144+
//
1145+
}
11291146

11301147
return this.send(webVitalsEvent);
11311148
}
@@ -1189,7 +1206,9 @@
11891206
r.getAttribute('alt'),
11901207
});
11911208
}
1192-
} catch (_e) {}
1209+
} catch (_e) {
1210+
//
1211+
}
11931212
}
11941213
}
11951214
});
@@ -1349,8 +1368,7 @@
13491368
document.currentScript ||
13501369
(() => {
13511370
const scripts = document.getElementsByTagName('script');
1352-
// biome-ignore lint/style/useAt: not supported in all target browsers
1353-
return scripts[scripts.length - 1];
1371+
return scripts.at(-1);
13541372
})();
13551373

13561374
function getConfig() {
@@ -1397,7 +1415,9 @@
13971415
urlParams[key] = value;
13981416
}
13991417
});
1400-
} catch (_e) {}
1418+
} catch (_e) {
1419+
//
1420+
}
14011421

14021422
const config = {
14031423
...globalConfig,

0 commit comments

Comments
 (0)