MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getGlobalSingleton

Function getGlobalSingleton

packages/core/src/carrier.ts:84–93  ·  view source on GitHub ↗
(
  name: Prop,
  creator: () => NonNullable<SentryCarrier[Prop]>,
  obj = GLOBAL_OBJ,
)

Source from the content-addressed store, hash-verified

82 * @returns the singleton
83 */
84export function getGlobalSingleton<Prop extends keyof SentryCarrier>(
85 name: Prop,
86 creator: () => NonNullable<SentryCarrier[Prop]>,
87 obj = GLOBAL_OBJ,
88): NonNullable<SentryCarrier[Prop]> {
89 const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});
90 const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
91 // Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes
92 return carrier[name] || (carrier[name] = creator());
93}

Callers 6

getDefaultCurrentScopeFunction · 0.90
getDefaultIsolationScopeFunction · 0.90
getGlobalScopeFunction · 0.90
_getBufferMapFunction · 0.90
_getLoggerSettingsFunction · 0.90
_getBufferMapFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected