Created
August 20, 2021 18:44
-
-
Save samoshkin/7dbe8c70717d9279bcc05cdb0e69edb8 to your computer and use it in GitHub Desktop.
Conditionally build array using logical AND operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const deployment = { | |
debug: process.env.NODE_ENV === 'development', | |
}; | |
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe'); | |
return [ | |
// add all the default integrations but those which were excluded using spread syntax | |
...defaultIntegrations, | |
// Extracts all non-native attributes from the Error object and attaches them to the event as the extra data | |
new ExtraErrorDataIntegration(), | |
// print event to DevTools console before sending it to Sentry | |
// enable this integration only in DEBUG mode | |
deployment.debug && new DebugIntegration(), | |
// send all console.log() messages to Sentry in DEBUG mode | |
deployment.debug && new CaptureConsoleIntegration(), | |
// in RELEASE mode | |
// Uses the web browser's online and offline events to detect when no network connectivity is available. | |
// If offline, it saves events to the web browser's client-side storage (typically IndexedDB), | |
// then automatically uploads events when network connectivity is restored. | |
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/Online_and_offline_events | |
!deployment.debug && new OfflineIntegration(), | |
].filter(Boolean); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment