Home > @uniformdev/context > TransitionDataStore
TransitionDataStore class
Signature:
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)({ initialData }) | Constructs a new instance of the <code>TransitionDataStore</code> class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
data | <code>readonly</code> | Partial<VisitorData> | undefined | |
events | <code>readonly</code> | { on: { <Key extends "dataUpdatedAsync">(type: Key, handler: mitt.Handler<TransitionDataStoreEvents>): void; }; } | Subscribe to events from the transition storage |
initialData | <code>readonly</code> | Partial<VisitorData> | undefined |
Methods
Method | Modifiers | Description |
---|---|---|
delete(fromAllDevices) | Deletes a visitor's stored data, forgetting them. | |
getClientTransitionState() | When we load on the client side after a server side rendering has occurred (server to client transition), we can have a page script (ID: __UNIFORM_DATA__) that contains the computed visitor data from the SSR/edge render. This data is injected into the first render to allow score syncing and the server to request commands be applied to the client side data store. | |
handleDelete(fromAllDevices) | <code>abstract</code> | Deletes a visitor's stored data, forgetting them. Important: do not emit any async score update events from this function. |
handleUpdateData(commands, computedValue) | <code>abstract</code> | <p>Updates visitor data in the transition store.</p><p>NOTE: The updated data is optimistically stored in TransitionDataStore automatically, so unless the updated data is _changed_ by the backend data store, there is no need to emit async score changed events when the visitor data is done updating.</p> |
signalAsyncDataUpdate(newScores) | <code>protected</code> | |
updateData(commands, computedValue) | Updates data in the transition storage. |