Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Make timeout for Ajax call configurable #166

Merged
merged 7 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/idex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class IdentityResolver {
this.source = this.idexConfig.source || 'unknown'
this.publisherId = this.idexConfig.publisherId || 'any'
this.url = this.idexConfig.url || DEFAULT_IDEX_URL
this.timeout = this.idexConfig.ajaxTimeout || DEFAULT_IDEX_AJAX_TIMEOUT
this.timeout = this.idexConfig.ajaxTimeout || config.ajaxTimeout || DEFAULT_IDEX_AJAX_TIMEOUT
this.requestedAttributes = this.idexConfig.requestedAttributes || DEFAULT_REQUESTED_ATTRIBUTES
this.tuples = []

Expand Down
4 changes: 3 additions & 1 deletion src/pixel/sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const DEFAULT_AJAX_TIMEOUT = 0

export class PixelSender {
url: string
timeout: number
calls: WrappedCallHandler
eventBus: EventBus
onload?: () => void
presend?: () => void

constructor (liveConnectConfig: LiveConnectConfig, calls: WrappedCallHandler, eventBus: EventBus, onload?: () => void, presend?: () => void) {
this.url = (liveConnectConfig && liveConnectConfig.collectorUrl) || 'https://rp.liadm.com'
this.timeout = (liveConnectConfig && liveConnectConfig.ajaxTimeout) || DEFAULT_AJAX_TIMEOUT
this.calls = calls
this.eventBus = eventBus
this.onload = onload
Expand Down Expand Up @@ -59,7 +61,7 @@ export class PixelSender {
this.sendPixel(state)
this.eventBus.emitError('AjaxFailed', e)
},
DEFAULT_AJAX_TIMEOUT
this.timeout
)
})
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface LiveConnectConfig {
globalVarName?: string
urlCollectionMode?: UrlCollectionMode
queryParametersFilter?: string
ajaxTimeout?: number
}

export type ResolutionParams = Record<string, string | string[]>
Expand Down
Loading