Appearance
Function: parseEmbedState()
ts
function parseEmbedState(url: string | URL): StateValues;Read dashboard state from a URL's state query parameter. The parameter contains JSON encoded as UTF-8 base64. If it appears more than once, the last value is used.
A missing parameter returns {}. Malformed or structurally invalid state also returns {} and logs a warning. This checks the state format; each component validates its own values when the state is applied.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | URL | An absolute URL string or a URL object containing the initial state. |
Returns
The decoded state, keyed by component id, or {} if no valid state is available.
Throws
TypeError if the string cannot be parsed as an absolute URL.
Example
ts
const state = parseEmbedState(window.location.href);