Skip to content

Commit 19b4360

Browse files
author
Niall Brennan
committed
add flush policy docs
1 parent fe9642c commit 19b4360

File tree

1 file changed

+3
-3
lines changed
  • src/connections/sources/catalog/libraries/mobile/react-native

1 file changed

+3
-3
lines changed

src/connections/sources/catalog/libraries/mobile/react-native/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ If you don't do this, the old client instance would still exist and retain the t
340340
Ideally, you shouldn't have to use this method, and the Segment client should be initialized only once in the application lifecycle.
341341
342342
## Controlling Upload With Flush Policies
343-
To more granurily control when events are uploaded you can use `FlushPolicies`
343+
To granularly control when events are uploaded you can use `FlushPolicies`.
344344
A Flush Policy defines the strategy for deciding when to flush, this can be on an interval, on a certain time of day, after receiving a certain number of events or even after receiving a particular event. This gives you even more flexibility on when to send event to Segment.
345345
To make use of flush policies you can set them in the configuration of the client:
346346
```ts
@@ -361,7 +361,7 @@ We have several standard FlushPolicies:
361361
- `StartupFlushPolicy` triggers on client startup only
362362
363363
### Adding or removing policies
364-
One of the main advatanges of FlushPolicies is that you can add and remove policies on the fly. This is very powerful when you want to reduce or increase the amount of flushes.
364+
One of the main advantages of FlushPolicies is that you can add and remove policies on the fly. This is very powerful when you want to reduce or increase the amount of flushes.
365365
For example you might want to disable flushes if you detect the user has no network:
366366
```ts
367367
import NetInfo from "@react-native-community/netinfo";
@@ -392,7 +392,7 @@ A `FlushPolicy` only needs to implement 2 methods:
392392
- `start()`: Executed when the flush policy is enabled and added to the client. This is a good place to start background operations, make async calls, configure things before execution
393393
- `onEvent(event: SegmentEvent)`: Gets called on every event tracked by your client
394394
- `reset()`: Called after a flush is triggered (either by your policy, by another policy or manually)
395-
They also have a `shouldFlush` observable boolean value. When this is set to true the client will atempt to upload events. Each policy should reset this value to `false` according to its own logic, although it is pretty common to do it inside the `reset` method.
395+
They also have a `shouldFlush` observable boolean value. When this is set to true the client will attempt to upload events. Each policy should reset this value to `false` according to its own logic, although it is pretty common to do it inside the `reset` method.
396396
```ts
397397
export class FlushOnScreenEventsPolicy extends FlushPolicyBase {
398398
onEvent(event: SegmentEvent): void {

0 commit comments

Comments
 (0)