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

Function initAndBind

packages/core/src/sdk.ts:17–39  ·  view source on GitHub ↗
(
  clientClass: ClientClass<F, O>,
  options: O,
)

Source from the content-addressed store, hash-verified

15 * @param options Options to pass to the client.
16 */
17export function initAndBind<F extends Client, O extends ClientOptions>(
18 clientClass: ClientClass<F, O>,
19 options: O,
20): Client {
21 if (options.debug === true) {
22 if (DEBUG_BUILD) {
23 debug.enable();
24 } else {
25 // use `console.warn` rather than `debug.warn` since by non-debug bundles have all `debug.x` statements stripped
26 consoleSandbox(() => {
27 // eslint-disable-next-line no-console
28 console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
29 });
30 }
31 }
32 const scope = getCurrentScope();
33 scope.update(options.initialScope);
34
35 const client = new clientClass(options);
36 setCurrentClient(client);
37 client.init();
38 return client;
39}
40
41/**
42 * Make the given client the current client.

Callers 11

initTestClientFunction · 0.90
initTestClientFunction · 0.90
initFunction · 0.90
hint.test.tsFile · 0.90
sdk.test.tsFile · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.90
initFunction · 0.85

Calls 7

consoleSandboxFunction · 0.90
getCurrentScopeFunction · 0.90
setCurrentClientFunction · 0.85
enableMethod · 0.65
warnMethod · 0.65
updateMethod · 0.45
initMethod · 0.45

Tested by 2

initTestClientFunction · 0.72
initTestClientFunction · 0.72