From 62a74dfa42ff44e78fc3f409dd4a2decb9653419 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Thu, 4 Mar 2021 08:54:35 -0500 Subject: [PATCH 1/2] Add documentation for Offline integration See https://github.com/getsentry/sentry-javascript/pull/2778 Remove backticks from plugin.mdx's description; PageGrid doesn't render them as monospace, so they appear as literals in https://docs.sentry.io/platforms/javascript/configuration/integrations/, and the default.mdx description doesn't use them for its class names. --- .../configuration/offline/javascript.mdx | 38 +++++++++++++++++++ .../configuration/integrations/plugin.mdx | 13 ++++++- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 src/includes/configuration/offline/javascript.mdx 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..c88b032d05662 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`_ From 904219c139037bd88bbeb15f3d773b36605e2b46 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Fri, 5 Mar 2021 11:11:42 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../javascript/common/configuration/integrations/plugin.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/javascript/common/configuration/integrations/plugin.mdx b/src/platforms/javascript/common/configuration/integrations/plugin.mdx index c88b032d05662..768abcbfc2c75 100644 --- a/src/platforms/javascript/common/configuration/integrations/plugin.mdx +++ b/src/platforms/javascript/common/configuration/integrations/plugin.mdx @@ -58,7 +58,7 @@ _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. +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.