# Class: AppViewService Handle and track page/popup usage for an App ### Properties #### currentUiView • `Readonly` **currentUiView**: `Subscribable`<`null` \| [`UiViewEntry`](../../interfaces/interface-uiviewentry/)<`UiViewRef`>> The page that is currently open in the active view stack. ### Methods #### registerView ▸ **registerView**(`key`, `type`, `vNodeFactory`, `options?`): [`UiViewEntry`](../../interfaces/interface-uiviewentry/)<`UiViewRef`> Registers and renders a view (page or popup) to be opened by the service. ##### Parameters {{< table-wrapper >}} | Name | Type | Description | |:----|:----|:------| | `key` | `string` | The UiView string key. | | `type` | [`ViewType`](../../modules/#viewtype)| The view type | | `vNodeFactory` | () => [`TVNode`](../../interfaces/interface-tvnode/)<`UiView`<`UiViewProps`>, `UiViewProps`> | A function that returns a UiView VNode for the key | | `options?` | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)<[`ViewOptions`](../../interfaces/interface-viewoptions/)> | The UiView [ViewOptions](../../interfaces/interface-viewoptions/) | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} [`UiViewEntry`](../../interfaces/interface-uiviewentry/)<`UiViewRef`> UiViewEntry ---------------------------------------------------------------------------------------------- #### unload ▸ **unload**(): `void` Destroys every view in registered view entries and resets the view stack. {{< fake-header "5" "Returns" >}} `void` ---------------------------------------------------------------------------------------------- #### initialize ▸ **initialize**(`homePageUiViewKey`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`> ##### Parameters {{< table-wrapper >}} | Name | Type | Description| |:--------|:---------|:-----------| | `homePageUiViewKey` | `string` | the string key of the UiView | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`> a Promise resolving when all pages are initialized ---------------------------------------------------------------------------------------------- #### onAppContainerRendered ▸ **onAppContainerRendered**(`appViewRef`): `void` Called by AppContainer to pass in the refs to the view. Should only be called once. ##### Parameters {{< table-wrapper >}} | Name | Type| Description | |:---|:---|:---| | `appViewRef` | [`AppViewContainer`](../../interfaces/interface-appviewcontainer/) | The app view ref. | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} `void` ---------------------------------------------------------------------------------------------- #### openPage ▸ **openPage**<`Ref`>(`key`): [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`Ref`> Opens a UiView as a page and adds it to the stack. ##### Type parameters {{< table-wrapper >}} | Name | Type | |:------|:------| | `Ref` | `UiViewRef` | {{< /table-wrapper >}} ##### Parameters {{< table-wrapper >}} | Name | Type | Description | |:------|:---------|:------| | `key` | `string` | The UiView string key | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`Ref`> the [PublicUiViewEntry](../../modules/#publicuiviewentry) entry of the UiView **`Deprecated`** This method has been deprecated in favor of using AppViewService.open. ---------------------------------------------------------------------------------------------- #### openPopup ▸ **openPopup**<`Ref`>(`key`): [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`Ref`> Opens a UiView as a popup. The UiView will be brought to the top of the current view stack as the active view ##### Type parameters {{< table-wrapper >}} | Name | Type | |:------|:------| | `Ref` | `UiViewRef` | {{< /table-wrapper >}} ##### Parameters {{< table-wrapper >}} | Name | Type | Description | |:-----|:----|:----| | `key` | `string` | The UiView string key | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`Ref`> the [PublicUiViewEntry](../../modules/#publicuiviewentry) entry of the UiView **`Deprecated`** This method has been deprecated in favor of using AppViewService.open. ---------------------------------------------------------------------------------------------- #### goBack ▸ **goBack**(): `undefined` \| [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`UiViewRef`> Returns the most recent previous history state of the view stack {{< fake-header "5" "Returns" >}} `undefined` \| [`PublicUiViewEntry`](../../modules/#publicuiviewentry)<`UiViewRef`> the [PublicUiViewEntry](../../modules/#publicuiviewentry) entry of the previous UiView ---------------------------------------------------------------------------------------------- #### update ▸ **update**(`time`): `void` Updates all the pages/popups that are initialized and visible ##### Parameters {{< table-wrapper >}} | Name | Type | Description | |:----|:----|:----| | `time` | `number` | timestamp | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} `void` ---------------------------------------------------------------------------------------------- #### routeGamepadInteractionEvent ▸ **routeGamepadInteractionEvent**(`gamepadEvent`): `void` Routes the event to the current UiView ##### Parameters {{< table-wrapper >}} | Name | Type| Description | |:----|:-----|:----| | `gamepadEvent` | `GamepadEvents` | the GamepadEvents | {{< /table-wrapper >}} {{< fake-header "5" "Returns" >}} `void`