Skip to content

SI_UI_STATE_SERVICE Type documentation

Types Documentation

Interface that defines a UIStateStore. It must be provided via provideSiUiState .
Methods
Loads data for a specific stateId. Can be asynchronous.

Errors should be handled by the implementation. The SiUIStateService does not handle errors.

Returns The data or undefined if the data does not exist. Asynchronous implementations must return a Promise: Promise containing the data.
Parameters
stateId: string
(stateId: string, data: string) => (void | Promise<void>)
Saves data under a specific stateId. Already existing data for that stateId should be overridden. Asynchronous implementations must return a Promise: Promise and resolve it once saving was completed.

Errors should be handled by the implementation. The SiUIStateService does not handle errors.
Parameters
stateId: string
data: string
(config: { store: Type<UIStateStorage> }) => Provider[]
Function
Enables the automatic storage of UI state for enabled components.
Parameters
config?: { store: Type<UIStateStorage> }

Service to save and load UI states.
Constructor
() => {}
Properties
storage: UIStateStorage = ...
Methods
<TState: unknown> (stateId: string, version: number = 0) => PromiseLike<(undefined | TState)>
Loads and returns the state for the given stateId and version.
Returns A Promise containing the state or undefined if the state does not exist or the version did not match.
Parameters
The unique id or key for which the state shall be loaded.
stateId: string
The version of the state object. This can be used to migrate state objects.
version: number = 0
<TState: unknown> (data: (undefined | null | string), version: number) => (undefined | TState)
Parameters
data: (undefined | null | string)
version: number
<TState> (stateId: string, state: TState, version: number = 0) => Promise<void>
Saves the provided state in the storage.
Parameters
The unique id or key under which the state shall be saved.
stateId: string
The state to be saved.
state: TState
The version of the state object. This can be used to migrate state objects.
version: number = 0

Except where otherwise noted, content on this site is licensed under MIT License.