Allows you to receive the contextual state and environmental information of the dashboard.
The callback function provided to observeState
receives the state data. The function is triggered when the dashboard page or component initializes and whenever the state data is updated.
Name | Type | Description |
---|---|---|
observer | Observer | Callback function for receiving state data that takes two parameters:componentParams : The data that is sent to your component by your host, who is responsible for rendering it.environmentState : General information about the user's present environment. |
Name | Type | Description |
---|---|---|
componentParams | P | PageParams | A generic type parameter that contains the data sent to your component by your host (which is responsible for rendering your component). In the case of a dashboard page, which is rendered by the platform itself, componentParams is of type PageParams . |
environmentState | EnvironmentState | Information about the state of the dashboard's environment. |
Name | Type | Description |
---|---|---|
location | PageLocation | Information about the location of the rendered page. |
Name | Type | Description |
---|---|---|
locale | string | User's locale in ISO 639-1 format. |
pageLocation | PageLocation | Deprecated. Information about the currently rendered page location. |
Name | Type | Description |
---|---|---|
pageId | string | ID of the current page. |
pathname | string | Any parts of the current URL path appended to the page's full URL path. Learn more. |
search | string | Optional. The current URL's query string. |
hash | string | Optional. The current URL's fragment identifier. |
pathname
The value of pathname
is any part of the URL path that comes after the route to the current dashboard page.
For third-party app dashboard pages, this is anything appended to the URL after the Relative route value that you set when creating the dashboard page extension in the Wix Developers Center.
Note: To use this method in self-hosted apps, you need to create a client. See the setup guide for more details.