* 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)
| 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. |
no test coverage detected