Handle and track page/popup usage for an App

Properties

currentUiView

Readonly currentUiView: Subscribable<null | UiViewEntry<UiViewRef>>

The page that is currently open in the active view stack.

Methods

registerView

registerView(key, type, vNodeFactory, options?): UiViewEntry<UiViewRef>

Registers and renders a view (page or popup) to be opened by the service.

Parameters
NameTypeDescription
keystringThe UiView string key.
typeViewTypeThe view type
vNodeFactory() => TVNode<UiView<UiViewProps>, UiViewProps>A function that returns a UiView VNode for the key
options?Partial(opens in a new tab)<ViewOptions>The UiView ViewOptions

Returns

UiViewEntry<UiViewRef>

UiViewEntry


unload

unload(): void

Destroys every view in registered view entries and resets the view stack.

Returns

void


initialize

initialize(homePageUiViewKey): Promise(opens in a new tab)<void>

Parameters
NameTypeDescription
homePageUiViewKeystringthe string key of the UiView

Returns

Promise(opens in a new tab)<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
NameTypeDescription
appViewRefAppViewContainerThe app view ref.

Returns

void


openPage

openPage<Ref>(key): PublicUiViewEntry<Ref>

Opens a UiView as a page and adds it to the stack.

Type parameters
NameType
RefUiViewRef
Parameters
NameTypeDescription
keystringThe UiView string key

Returns

PublicUiViewEntry<Ref>

the PublicUiViewEntry entry of the UiView

Deprecated

This method has been deprecated in favor of using AppViewService.open.


openPopup

openPopup<Ref>(key): 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
NameType
RefUiViewRef
Parameters
NameTypeDescription
keystringThe UiView string key

Returns

PublicUiViewEntry<Ref>

the PublicUiViewEntry entry of the UiView

Deprecated

This method has been deprecated in favor of using AppViewService.open.


goBack

goBack(): undefined | PublicUiViewEntry<UiViewRef>

Returns the most recent previous history state of the view stack

Returns

undefined | PublicUiViewEntry<UiViewRef>

the PublicUiViewEntry entry of the previous UiView


update

update(time): void

Updates all the pages/popups that are initialized and visible

Parameters
NameTypeDescription
timenumbertimestamp

Returns

void


routeGamepadInteractionEvent

routeGamepadInteractionEvent(gamepadEvent): void

Routes the event to the current UiView

Parameters
NameTypeDescription
gamepadEventGamepadEventsthe GamepadEvents

Returns

void