From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../@sentry/utils/esm/vendor/supportsHistory.js | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js (limited to 'shared/logger/node_modules/@sentry/utils/esm/vendor') diff --git a/shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js b/shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js new file mode 100644 index 0000000..cf33d64 --- /dev/null +++ b/shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js @@ -0,0 +1,29 @@ +import { getGlobalObject } from '../worldwide.js'; + +// Based on https://github.com/angular/angular.js/pull/13945/files + +// eslint-disable-next-line deprecation/deprecation +const WINDOW = getGlobalObject(); + +/** + * Tells whether current environment supports History API + * {@link supportsHistory}. + * + * @returns Answer to the given question. + */ +function supportsHistory() { + // NOTE: in Chrome App environment, touching history.pushState, *even inside + // a try/catch block*, will cause Chrome to output an error to console.error + // borrowed from: https://github.com/angular/angular.js/pull/13945/files + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const chrome = (WINDOW ).chrome; + const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; + /* eslint-enable @typescript-eslint/no-unsafe-member-access */ + const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState; + + return !isChromePackagedApp && hasHistoryApi; +} + +export { supportsHistory }; +//# sourceMappingURL=supportsHistory.js.map -- cgit v1.2.3