(options: BrowserOptions)
| 17 | * @param options Configuration options for the SDK. |
| 18 | */ |
| 19 | export 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 | |
| 41 | function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefined { |
| 42 | // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false", |
no test coverage detected