MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / init

Function init

packages/sveltekit/src/client/sdk.ts:19–39  ·  view source on GitHub ↗
(options: BrowserOptions)

Source from the content-addressed store, hash-verified

17 * @param options Configuration options for the SDK.
18 */
19export function init(options: BrowserOptions): Client | undefined {
20 const opts = {
21 defaultIntegrations: getDefaultIntegrations(options),
22 ...options,
23 };
24
25 applySdkMetadata(opts, 'sveltekit', ['sveltekit', 'svelte']);
26
27 // 1. Switch window.fetch to our fetch proxy we injected earlier
28 const actualFetch = switchToFetchProxy();
29
30 // 2. Initialize the SDK which will instrument our proxy
31 const client = initSvelteSdk(opts);
32
33 // 3. Restore the original fetch now that our proxy is instrumented
34 if (actualFetch) {
35 restoreFetch(actualFetch);
36 }
37
38 return client;
39}
40
41function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefined {
42 // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false",

Callers 2

sdk.test.tsFile · 0.90
sdk.test.tsFile · 0.90

Calls 4

getDefaultIntegrationsFunction · 0.90
applySdkMetadataFunction · 0.90
switchToFetchProxyFunction · 0.85
restoreFetchFunction · 0.85

Tested by

no test coverage detected