Files
klz-cables.com/.pnpm-store/v10/files/f4/00c212a77e890ac9a62519adebcb52923f7198ceadf7958d2a71473c526e91742180f81a45c9803d4e7b92cbd4ba3592eadd504ddd752730afd56c968efd10
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

60 lines
2.4 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const types = require('../../../types.js');
const globalListeners = require('./globalListeners.js');
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Sentry-specific change:
*
* This function's logic was NOT updated to web-vitals 4.2.4 or 5.x but we continue
* to use the web-vitals 3.5.2 version due to having stricter browser support.
*
* PR with context that made the changes:
* https://github.com/GoogleChrome/web-vitals/pull/442/files#r1530492402
*
* The PR removed listening to the `pagehide` event, in favour of only listening to
* the `visibilitychange` event. This is "more correct" but some browsers we still
* support (Safari <14.4) don't fully support `visibilitychange` or have known bugs
* with respect to the `visibilitychange` event.
*
* TODO (v11): If we decide to drop support for Safari 14.4, we can use the logic
* from web-vitals 4.2.4. In this case, we also need to update the integration tests
* that currently trigger the `pagehide` event to simulate the page being hidden.
*
* @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden or unloaded.
*
* @deprecated use `whenIdleOrHidden` or `addPageListener('visibilitychange')` instead
*/
const onHidden = (cb) => {
const onHiddenOrPageHide = (event) => {
if (event.type === 'pagehide' || types.WINDOW.document?.visibilityState === 'hidden') {
cb(event);
}
};
globalListeners.addPageListener('visibilitychange', onHiddenOrPageHide, { capture: true, once: true });
// Some browsers have buggy implementations of visibilitychange,
// so we use pagehide in addition, just to be safe.
globalListeners.addPageListener('pagehide', onHiddenOrPageHide, { capture: true, once: true });
};
exports.onHidden = onHidden;
//# sourceMappingURL=onHidden.js.map