Skip to main content

Class: ViewService

A service to manage views.

Hierarchy

Constructors

constructor

new ViewService(bus): ViewService

Constructs the view service.

Parameters

NameTypeDescription
busEventBusThe event bus.

Returns

ViewService

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:50

Properties

activeView

Readonly activeView: Subscribable<null | UiView<UiViewProps, any, any>>

The currently active view.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:36


activeViewKey

Readonly activeViewKey: Subscribable<string>

The key of the currently active view.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:34


bus

Protected Readonly bus: EventBus

The event bus.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:50


fmsEventMap

Protected Readonly fmsEventMap: Map<string, FmsHEvent>

override in child class

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:42


ignorePageHistory

Protected ignorePageHistory: boolean = false

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:39


openPage

Readonly openPage: Subscribable<null | UiPage<UiPageProps>>

The currently open page.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:30


openPageKey

Readonly openPageKey: Subscribable<string>

The key of the currently open page.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:28


pageHistory

Protected Readonly pageHistory: ViewEntry<UiView<UiViewProps, any, any>>[] = []

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:38

Methods

clearPageHistory

clearPageHistory(): void

Clears this view service's page history.

Returns

void

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:231


clearStack

clearStack(closePage): void

Closes all open views and clears the stack.

Parameters

NameTypeDescription
closePagebooleanWhether to close the currently open page, if one exists.

Returns

void

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:253


closeActiveView

closeActiveView(): void

Closes the currently active view.

Returns

void

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:238


closeAllViews

closeAllViews(): void

Closes all open views except for the currently open page, if one exists.

Returns

void

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:245


getOpenViews

getOpenViews(): readonly UiView<UiViewProps, any, any>[]

Gets an array of all currently open views.

Returns

readonly UiView<UiViewProps, any, any>[]

an array of all currently open views.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:93


onInteractionEvent

onInteractionEvent(hEvent): boolean

Routes the HEvents to the views.

Parameters

NameTypeDescription
hEventstringThe event identifier.

Returns

boolean

whether the event was handled

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:64


open

open<T>(type, isSubView?): T

Opens a view. The opened view can be a page, regular view, or subview. Opening a page will close all other views, including the currently open page. Opening a regular view will close all other views except the currently open page. Opening a subview does not close any other views. The opened view will immediately become the active view, and the previously active view (if one exists) will be paused.

Type parameters

NameType
Textends UiView<UiViewProps, any, any> = UiView<UiViewProps, any, any>

Parameters

NameTypeDefault valueDescription
typestringundefinedThe type of the view to open.
isSubViewbooleanfalseA boolean indicating if the view to be opened is a subview.

Returns

T

The view that was opened.

Throws

Error if the view type is not registered with this service.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:117


openLastPage

openLastPage(): null | UiPage<UiPageProps>

Opens the page that was most recently closed.

Returns

null | UiPage<UiPageProps>

The page that was opened.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:217


registerView

registerView(type?, vnodeFn): void

Registers a view with the service.

Parameters

NameTypeDescription
type?stringThe type of the view.
vnodeFn() => VNodeA function creating the VNode.

Returns

void

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:102


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

NameTypeDescription
evtFmsHEventAn interaction event.

Returns

boolean

Whether the event was handled.

Defined in

workingtitle-instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/UI/ViewService.ts:81