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

Function addIntegration

packages/core/src/client.ts:532–545  ·  view source on GitHub ↗

* Add an integration to the client. * This can be used to e.g. lazy load integrations. * In most cases, this should not be necessary, * and you're better off just passing the integrations via `integrations: []` at initialization time. * However, if you find the need to conditionally load

(integration: Integration)

Source from the content-addressed store, hash-verified

530 * However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
531 */
532 public addIntegration(integration: Integration): void {
533 const isAlreadyInstalled = this._integrations[integration.name];
534
535 if (!isAlreadyInstalled && integration.beforeSetup) {
536 integration.beforeSetup(this);
537 }
538
539 // This hook takes care of only installing if not already installed
540 setupIntegration(this, integration, this._integrations);
541 // Here we need to check manually to make sure to not run this multiple times
542 if (!isAlreadyInstalled) {
543 afterSetupIntegrations(this, [integration]);
544 }
545 }
546
547 /**
548 * Send a fully prepared event to Sentry.

Callers 2

_loadAndRenderDialogFunction · 0.90
instrumentForPerformanceFunction · 0.90

Calls 3

setupIntegrationFunction · 0.90
afterSetupIntegrationsFunction · 0.90
beforeSetupMethod · 0.80

Tested by

no test coverage detected