You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/react-native/integrations/custom.mdx
+8-13Lines changed: 8 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Custom Integrations
3
3
sidebar_order: 200
4
-
description: "Learn how you can enable a custom integration."
4
+
description: "Learn how to enable a custom integration."
5
5
---
6
6
7
7
In addition to the integrations that come with the SDK, you can also write custom integrations.
@@ -32,7 +32,7 @@ All hooks on an integration are optional. The only required field is the `name`.
32
32
### `setup`
33
33
34
34
The `setup` hook is called when the SDK is initialized. It receives the client instance as an argument.
35
-
You should use this if you want to run some code on initialization.
35
+
You should use this if you want to run some code upon initialization.
36
36
37
37
```javascript
38
38
constintegration= {
@@ -45,7 +45,7 @@ const integration = {
45
45
46
46
### `processEvent`
47
47
48
-
This hook can be used to modify events before they are sent to Sentry. It receives the event as an argument and should return the modified event. The hook also receives a hint object that may hold additional event metadata, and the client that is sending the event. You can also return `null` to drop the event from being sent.
48
+
This hook can be used to modify events before they're sent to Sentry. It receives the event as an argument and should return the modified event. The hook also receives a hint object that may hold additional event metadata, as well as the client that's sending the event. You can also return `null` to drop the event from being sent.
49
49
50
50
```javascript
51
51
constintegration= {
@@ -66,11 +66,11 @@ You can also return a promise that resolves with an event or `null`. However, th
66
66
67
67
### `preprocessEvent`
68
68
69
-
This hook is similar to `processEvent`, but it is called before the event is passed to any other `processEvent` hook. It can be used in places where the order of processing is important.
69
+
This hook is similar to `processEvent`, but it's called before the event is passed to any other `processEvent` hook. It can be used in places where the order of processing is important.
70
70
71
-
In most cases, you should just use `processEvent`. Only use `preprocessEvent` if you need to ensure that your hook is called before any other `processEvent` hook.
71
+
You can use `processEvent` for most cases, but only when you need to ensure that your hook is called before any other `processEvent` hook use `preprocessEvent`.
72
72
73
-
Similar to `processEvent`, this hooks receives the event, hint, and client as arguments. However, this hook does not allow to return a modified event or `null` to drop the event - instead, you can only mutate the passed in event in this hook:
73
+
Similar to `processEvent`, this hook receives the event, hint, and client as arguments. However, this hook won't allow the return of a modified event and won't `null` to drop the event. You can only mutate the passed in event in this hook:
74
74
75
75
```javascript
76
76
constintegration= {
@@ -87,8 +87,7 @@ const integration = {
87
87
88
88
### `setupOnce`
89
89
90
-
This hook is similar to `setup`, but it is only run once, even if the SDK is re-initialized. It does not receive any arguments.
91
-
You should probably not use this, but use `setup` instead. The only reason to use `setupOnce` is e.g. when you may be calling `Sentry.init()` multiple times and you want to ensure a certain piece of code is only run once.
90
+
This hook is similar to `setup`, but it's only run once, even if the SDK is re-initialized. It won't receive any arguments. We recommend that you use `setup` instead. The only reason to use `setupOnce` is when you may be calling `Sentry.init()` multiple times and you want to ensure a certain piece of code is only run once.
92
91
93
92
```javascript
94
93
constintegration= {
@@ -101,12 +100,8 @@ const integration = {
101
100
102
101
### `afterAllSetup`
103
102
104
-
This hook is triggered after `setupOnce()` and `setup()` have been called for all integrations.
105
-
You can use it if it is important that all other integrations have been run before.
103
+
While we recommend that you use the `setup` hook in most cases, `afterAllSetup` can be used to make sure that all other integrations have been run. This hook receives the `client` that is being set up as the first argument and is triggered after `setupOnce()` and `setup()` have been called for all integrations.
106
104
107
-
In most cases, you should not need to use this hook, and should use `setup` instead.
108
-
109
-
The hook receives the `client` that is being set up as the first argument.
0 commit comments