mirror of
https://github.com/rxliuli/apps.apple.com.git
synced 2025-11-10 01:40:32 +00:00
init commit
This commit is contained in:
29
shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js
generated
vendored
Normal file
29
shared/logger/node_modules/@sentry/utils/esm/vendor/supportsHistory.js
generated
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user