clarity-js 0.8.47-beta → 0.8.48

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.
@@ -1,35 +0,0 @@
1
- import { Constant } from "@clarity-types/core";
2
- import { Code, Severity } from "@clarity-types/data";
3
- import * as clarity from "@src/clarity";
4
- import api from "@src/core/api";
5
- import measure from "@src/core/measure";
6
- import * as internal from "@src/diagnostic/internal";
7
-
8
- let bound = false;
9
-
10
- export function start(): void {
11
- // Only bind once - this listener must persist even when Clarity stops
12
- // to detect when the page is restored from bfcache
13
- if (!bound) {
14
- try {
15
- window[api(Constant.AddEventListener)]("pageshow", measure(handler) as EventListener, { capture: false, passive: true });
16
- bound = true;
17
- } catch {
18
- /* do nothing */
19
- }
20
- }
21
- }
22
-
23
- function handler(evt: PageTransitionEvent): void {
24
- // The persisted property indicates if the page was loaded from bfcache
25
- if (evt && evt.persisted) {
26
- // Restart Clarity since it was stopped when the page entered bfcache
27
- clarity.start();
28
- internal.log(Code.BFCache, Severity.Info);
29
- }
30
- }
31
-
32
- export function stop(): void {
33
- // Intentionally don't remove the listener or reset 'bound' flag
34
- // We need the listener to persist to detect bfcache restoration
35
- }