Skip to content

Commit 53a06e6

Browse files
committed
wip
1 parent 032d6a8 commit 53a06e6

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

packages/browser/src/plugins/segmentio/shared-dispatcher.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,38 @@ export type AdditionalHeaders =
1818
| Record<string, string>
1919
| (() => Record<string, string>)
2020

21-
/**
22-
* Priority of the request.
23-
* chrome only
24-
* @default 'auto'
25-
*/
2621
export type FetchPriority = 'high' | 'low' | 'auto'
2722

28-
export type BatchingDispatchConfig = {
29-
size?: number
30-
timeout?: number
31-
maxRetries?: number
32-
additionalHeaders?: AdditionalHeaders
33-
/**
34-
* This is useful for ensuring that events are sent even if the user navigates away from the page.
35-
* @default false IF the page is being unloaded, true otherwise
36-
*/
37-
keepalive?: boolean
38-
fetchPriority?: FetchPriority
39-
}
40-
41-
export type StandardDispatcherConfig = {
23+
interface DispatchConfig {
4224
/**
4325
* This is useful for ensuring that an event is sent even if the user navigates away from the page.
4426
* However, it may increase the likelihood of events being lost, as there is a 64kb limit for all fetch requests with keepalive (which is why it's disabled by default).
4527
* @default false
4628
*/
4729
keepalive?: boolean
30+
/**
31+
* Additional headers to be sent with the request.
32+
* Default is `Content-Type: text/plain`. This can be overridden.
33+
* If a function is provided, it will be called before each request.
34+
* @example { 'Content-Type': 'application/json' } or () => { 'Content-Type': 'application/json' }
35+
*/
4836
additionalHeaders?: AdditionalHeaders
37+
/**
38+
* Priority of the request.
39+
* chrome only
40+
* @default 'auto'
41+
*/
4942
fetchPriority?: FetchPriority
5043
}
5144

45+
export interface BatchingDispatchConfig extends DispatchConfig {
46+
size?: number
47+
timeout?: number
48+
maxRetries?: number
49+
}
50+
51+
export interface StandardDispatcherConfig extends DispatchConfig {}
52+
5253
export type DeliveryStrategy =
5354
| {
5455
strategy?: 'standard'

0 commit comments

Comments
 (0)