Class: MenuViewService<K>
A service to manage menu views.
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Constructors
constructor
• new MenuViewService<K
>(): MenuViewService
<K
>
Ctor
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Returns
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:41
Properties
activeView
• Readonly
activeView: Subscribable
<null
| GuiDialog
<GuiDialogProps
>>
The currently active view.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:28
activeViewKey
• Readonly
activeViewKey: Subscribable
<""
| string
& keyof K
>
The key of the currently active view.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:26
guiEventMap
• Protected
Readonly
guiEventMap: Map
<string
, GuiHEvent
>
override in child class
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:31
interactionTimeoutId
• Protected
interactionTimeoutId: null
| number
= null
Tracks the current timeout timer, used for closing the menu after 10 seconds of inactivity.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:34
Methods
clearStack
▸ clearStack(closePage
): void
Closes all open views and clears the stack.
Parameters
Name | Type | Description |
---|---|---|
closePage | boolean | Whether to close the currently open page, if one exists. |
Returns
void
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:149
onInteractionEvent
▸ onInteractionEvent(hEvent
, instrumentIndex
): boolean
Routes the HEvents to the views.
Parameters
Name | Type | Description |
---|---|---|
hEvent | string | The event identifier. |
instrumentIndex | number | The index of the instrument. |
Returns
boolean
Whether the event was handled.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:52
open
▸ open<T
>(type
): T
Opens a view. Opening a page will close all other views,
Type parameters
Name | Type |
---|---|
T | extends GuiDialog <GuiDialogProps > |
Parameters
Name | Type | Description |
---|---|---|
type | string & keyof K | The type of the view to open. |
Returns
T
The view that was opened.
Throws
Error if the view type is not registered with this service.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:82
registerView
▸ registerView(type?
, vnodeFn
): void
Registers a view with the service.
Parameters
Name | Type | Description |
---|---|---|
type? | string & keyof K | The type of the view. |
vnodeFn | () => VNode | A function creating the VNode. |
Returns
void
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:172
routeInteractionEventToViews
▸ routeInteractionEventToViews(evt
): boolean
Routes an interaction to the active view, and if it is not handled, re-routes the interaction to the currently open page if it exists and is not the active view.
Parameters
Name | Type | Description |
---|---|---|
evt | GuiHEvent | An interaction event. |
Returns
boolean
Whether the event was handled.
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:67
startInteractionTimeout
▸ startInteractionTimeout(): void
Starts/resets a 10 second timer, which will close the menu when finished. Call this function whenever there is an interaction with the menu.
Returns
void
Defined in
workingtitle-instruments-wt21/shared/UI/MenuViewService.ts:178