observeState

Allows to receive contextual state and environmental information of the dashboard. The callback function provided to observeState receives the state data. The function is triggered when dashboard component initializes and whenever the state data is updated.

Common use cases for this method

  1. A dashboard page in an app's backoffice, receiving environment data from the host such as the user's locale.
  2. A widget rendered within the dashboard, receiving contextual data from the page that's hosting it.
  3. A modal opened from a dashboard page or from a widget, receiving data from either.

署名

コピー
1

Function Parameters

名称タイプ説明
observerObserverCallback 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.

Observer

コピー
1
名称タイプ説明
componentParamsPA generic type parameter that indicates the data that is sent to your component by your host, who is responsible for rendering the component.
environmentStateEnvironmentStateState of the dashboard's environment.

EnvironmentState

コピー
1
名称タイプ説明
localeストリングUser's locale in ISO 639-1 format.
pageLocationPageLocationInformation about the currently rendered page location.

PageLocation

コピー
1
名称タイプ説明
pageIdストリングID of the current page.
pathnameストリングAny parts of the current URL path appended to the page's full URL path. Learn more.
探索ストリングOptional. The current URL's query string.
hashストリング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.

To set up a dashboard client, refer to the setup guide.

Receive state passed by your host

コピー
1

Receive user's locale

コピー
1
役に立ちましたか?
はい
いいえ