Selection
OverviewDirect link to Overview
Object representing a Rokt selection available as a result of IntegrationLauncher.selectPlacements.
MethodsDirect link to Methods
closeDirect link to close
▸ close(): Promise<void>
Closes all placements in the selection. Depending on if Rokt's selection process is still in progress, the method either:
- removes placements already added on a page
- prevents placements from being added in the first place
Returns: Promise<void>
getPlacementsDirect link to get-placements
▸ getPlacements(): Promise<Array<Placement>>
Gets all placements returned for the selection. The method returns as soon as Rokt's selection process has concluded there are placements available to display on a page, but before the placements are loaded onto the page.
In case there are no placements available for the page, the method resolves with an empty array. If for any reason selection process fails the method rejects the promise with an error.
Returns: Promise<void>
onDirect link to on
▸ on<T>(event: string): Subscriber<SelectionEvent<T>>
Allows subscribing to events with a specific name coming from any placement in the selection. The method is effectively subscribing to Placement.on invoked for each of the placements.
Parameters:
| Name | Type | Description |
|---|---|---|
event | string | Name of the event to subscribe to |
Returns: Subscriber<T>
readyDirect link to ready
▸ ready(): Promise<T>
Allows waiting for each placement to become ready. Effectively the same as waiting for each Placement's ready in the selection to resolve.
If any of the placements in the selection for any reason fails to be loaded, the promise will reject with an error.
Returns: Promise<void>
sendDirect link to send
▸ send<T>(name: string, data?: T): Promise<void>
Allows sending an event to each placement. Effectively the same as invoking Placement.send for each placement in the selection.
Returned promise will be resolved once all placements handle the message.
Parameters:
| Name | Type | Description |
|---|---|---|
name | string | Name of the event |
data | T | Expected payload for a given event |
Returns: Promise<void>
setAttributesDirect link to set-attributes
▸ setAttributes(): Promise<void>
Allows setting additional attributes for the selection.
For relevancy purposes all attributes should be sent while making the selection.
Returns: Promise<void>
PropertiesDirect link to Properties
contextDirect link to context
• context : SelectionContext
Context of the selection done by Rokt.