diff --git a/src/includes/configuration/offline/javascript.mdx b/src/includes/configuration/offline/javascript.mdx new file mode 100644 index 0000000000000..24c4088997365 --- /dev/null +++ b/src/includes/configuration/offline/javascript.mdx @@ -0,0 +1,38 @@ +```javascript {tabTitle: JavaScript} +import * as Sentry from "@sentry/browser"; +import { Offline as OfflineIntegration } from "@sentry/integrations"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [new OfflineIntegration( + { + // limit how many events will be localled saved. Defaults to 30. + maxStoredEvents: number; + } + )], +}); +``` + +```jsx {tabTitle: CDN} + + + + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [new Offline( + { + // limit how many events will be localled saved. Defaults to 30. + maxStoredEvents: number; + } + )], +}); +``` diff --git a/src/platforms/javascript/common/configuration/integrations/plugin.mdx b/src/platforms/javascript/common/configuration/integrations/plugin.mdx index 1b44baf2690b3..768abcbfc2c75 100644 --- a/src/platforms/javascript/common/configuration/integrations/plugin.mdx +++ b/src/platforms/javascript/common/configuration/integrations/plugin.mdx @@ -1,6 +1,6 @@ --- title: Pluggable Integrations -description: "Learn more about pluggable integrations `ExtraErrorData`, `CaptureConsole`, `Dedupe`, `Debug`, `RewriteFrames`, `ReportingObserver`, which are snippets of code that augment functionality for specific applications and/or frameworks." +description: "Learn more about pluggable integrations ExtraErrorData, CaptureConsole, Dedupe, Debug, Offline, RewriteFrames, and ReportingObserver, which are snippets of code that augment functionality for specific applications and/or frameworks." redirect_from: - /platforms/javascript/integrations/plugin/ - /platforms/javascript/pluggable-integrations/ @@ -26,7 +26,6 @@ Available options: - ### CaptureConsole _Import name: `Sentry.Integrations.CaptureConsole`_ @@ -53,6 +52,16 @@ Available options: +### Offline + +_Import name: `Sentry.Integrations.Offline`_ + +This integration uses the web browser's [online and offline events](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/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. + +This plugin does not attempt to provide local storage or retries for other scenarios. For example, if the browser has a local area connection but no internet connection, then it may report that it's online, and Sentry's `Offline` plugin will not attempt to save or retry any send failures in this case. + + + ### RewriteFrames _Import name: `Sentry.Integrations.RewriteFrames`_