Skip to content

Commit 124950a

Browse files
Apply suggestions from code review - integrations
Co-authored-by: Liza Mock <[email protected]>
1 parent 54cefc5 commit 124950a

File tree

1 file changed

+8
-13
lines changed
  • docs/platforms/react-native/integrations

1 file changed

+8
-13
lines changed

docs/platforms/react-native/integrations/custom.mdx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Custom Integrations
33
sidebar_order: 200
4-
description: "Learn how you can enable a custom integration."
4+
description: "Learn how to enable a custom integration."
55
---
66

77
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`.
3232
### `setup`
3333

3434
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.
3636

3737
```javascript
3838
const integration = {
@@ -45,7 +45,7 @@ const integration = {
4545

4646
### `processEvent`
4747

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.
4949

5050
```javascript
5151
const integration = {
@@ -66,11 +66,11 @@ You can also return a promise that resolves with an event or `null`. However, th
6666

6767
### `preprocessEvent`
6868

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.
7070

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`.
7272

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:
7474

7575
```javascript
7676
const integration = {
@@ -87,8 +87,7 @@ const integration = {
8787

8888
### `setupOnce`
8989

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.
9291

9392
```javascript
9493
const integration = {
@@ -101,12 +100,8 @@ const integration = {
101100

102101
### `afterAllSetup`
103102

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.
106104

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.
110105

111106
```javascript
112107
const integration = {

0 commit comments

Comments
 (0)