Skip to content

Commit f82a570

Browse files
author
Luca Forstner
authored
feat(core/utils): Deprecate _browserPerformanceTimeOriginMode (#14505)
This export is completely internal and should not be exposed.
1 parent 42d045c commit f82a570

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

docs/migration/draft-v9-migration-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- Deprecated `BAGGAGE_HEADER_NAME`. No replacements.
3737
- Deprecated `makeFifoCache`. No replacements.
3838
- Deprecated `flatten`. No replacements.
39+
- Deprecated `_browserPerformanceTimeOriginMode`. No replacements.
3940

4041
## `@sentry/core`
4142

packages/core/src/utils-hoist/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export {
113113
} from './supports';
114114
export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise';
115115
export {
116+
// eslint-disable-next-line deprecation/deprecation
116117
_browserPerformanceTimeOriginMode,
117118
browserPerformanceTimeOrigin,
118119
dateTimestampInSeconds,

packages/core/src/utils-hoist/time.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export const timestampInSeconds = createUnixTimestampInSecondsFunc();
7070

7171
/**
7272
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.
73+
*
74+
* @deprecated This variable will be removed in the next major version.
7375
*/
7476
export let _browserPerformanceTimeOriginMode: string;
7577

@@ -84,6 +86,7 @@ export const browserPerformanceTimeOrigin = ((): number | undefined => {
8486

8587
const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
8688
if (!performance || !performance.now) {
89+
// eslint-disable-next-line deprecation/deprecation
8790
_browserPerformanceTimeOriginMode = 'none';
8891
return undefined;
8992
}
@@ -113,15 +116,18 @@ export const browserPerformanceTimeOrigin = ((): number | undefined => {
113116
if (timeOriginIsReliable || navigationStartIsReliable) {
114117
// Use the more reliable time origin
115118
if (timeOriginDelta <= navigationStartDelta) {
119+
// eslint-disable-next-line deprecation/deprecation
116120
_browserPerformanceTimeOriginMode = 'timeOrigin';
117121
return performance.timeOrigin;
118122
} else {
123+
// eslint-disable-next-line deprecation/deprecation
119124
_browserPerformanceTimeOriginMode = 'navigationStart';
120125
return navigationStart;
121126
}
122127
}
123128

124129
// Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.
130+
// eslint-disable-next-line deprecation/deprecation
125131
_browserPerformanceTimeOriginMode = 'dateNow';
126132
return dateNow;
127133
})();

packages/utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ export const supportsReferrerPolicy = supportsReferrerPolicy_imported;
593593
export const supportsReportingObserver = supportsReportingObserver_imported;
594594

595595
/** @deprecated Import from `@sentry/core` instead. */
596+
// eslint-disable-next-line deprecation/deprecation
596597
export const _browserPerformanceTimeOriginMode = _browserPerformanceTimeOriginMode_imported;
597598

598599
/** @deprecated Import from `@sentry/core` instead. */

0 commit comments

Comments
 (0)