@guardian/commercial-core 4.2.0 → 4.2.1
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.
|
@@ -83,9 +83,9 @@ const listener = (e) => {
|
|
|
83
83
|
};
|
|
84
84
|
const addVisibilityListeners = () => {
|
|
85
85
|
// Report all available metrics when the page is unloaded or in background.
|
|
86
|
-
window.addEventListener('visibilitychange', listener);
|
|
86
|
+
window.addEventListener('visibilitychange', listener, { once: true });
|
|
87
87
|
// Safari does not reliably fire the `visibilitychange` on page unload.
|
|
88
|
-
window.addEventListener('pagehide', listener);
|
|
88
|
+
window.addEventListener('pagehide', listener, { once: true });
|
|
89
89
|
};
|
|
90
90
|
const checkConsent = async () => {
|
|
91
91
|
const consentState = await (0, consent_management_platform_1.onConsent)();
|
|
@@ -80,9 +80,9 @@ const listener = (e) => {
|
|
|
80
80
|
};
|
|
81
81
|
const addVisibilityListeners = () => {
|
|
82
82
|
// Report all available metrics when the page is unloaded or in background.
|
|
83
|
-
window.addEventListener('visibilitychange', listener);
|
|
83
|
+
window.addEventListener('visibilitychange', listener, { once: true });
|
|
84
84
|
// Safari does not reliably fire the `visibilitychange` on page unload.
|
|
85
|
-
window.addEventListener('pagehide', listener);
|
|
85
|
+
window.addEventListener('pagehide', listener, { once: true });
|
|
86
86
|
};
|
|
87
87
|
const checkConsent = async () => {
|
|
88
88
|
const consentState = await onConsent();
|