Skip to content

Commit 448e380

Browse files
timfishlizokm
authored andcommitted
Document default Electron offline support (#5758)
Co-authored-by: Liza Mock <[email protected]> Closes #5364
1 parent 1e55f50 commit 448e380

File tree

1 file changed

+27
-0
lines changed
  • src/platforms/javascript/guides/electron

1 file changed

+27
-0
lines changed

src/platforms/javascript/guides/electron/index.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,33 @@ init({ /* config */ }, reactInit);
8282

8383
```
8484

85+
## Offline Support
86+
87+
The default transport automatically handles offline events caching. Following, are a
88+
number of options that allow you to customize queueing behavior:
89+
90+
```javascript
91+
import * as Sentry from "@sentry/electron/main";
92+
93+
Sentry.init({
94+
dsn: "___PUBLIC_DSN___",
95+
transportOptions: {
96+
// The maximum number of days to keep an event in the queue.
97+
maxQueueAgeDays: 30,
98+
// The maximum number of events to keep in the queue.
99+
maxQueueCount: 30,
100+
// Called every time the number of requests in the queue changes.
101+
queuedLengthChanged: (length) => { },
102+
// Called before attempting to send an event to Sentry. Used to override queuing behavior.
103+
//
104+
// Return 'send' to attempt to send the event.
105+
// Return 'queue' to queue and persist the event for sending later.
106+
// Return 'drop' to drop the event.
107+
beforeSend: (request) => isOnline() ? 'send' : 'queue'
108+
}
109+
});
110+
```
111+
85112
## Inter-Process Communication
86113

87114
To give detailed information for all events including native crashes, the SDK merges context, scope and breadcrumbs from all processes in the Electron `main` process.

0 commit comments

Comments
 (0)