Abstract Class: ViewService
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:23
A service to manage views.
Extended by
Constructors
Constructor
new ViewService(
bus):ViewService
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:53
Constructs the view service.
Parameters
| Parameter | Type | Description |
|---|---|---|
bus | EventBus | The event bus. |
Returns
ViewService
Properties
activeView
readonlyactiveView:Subscribable<null|UiView<UiViewProps,any,any>>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:39
The currently active view.
activeViewKey
readonlyactiveViewKey:Subscribable<string>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:37
The key of the currently active view.
bus
protectedreadonlybus:EventBus
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:53
The event bus.
fmsEventMap
protectedreadonlyfmsEventMap:Map<string,FmsHEvent>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:45
override in child class
ignorePageHistory
protectedignorePageHistory:boolean=false
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:42
openPage
readonlyopenPage:Subscribable<null|UiPage<UiPageProps>>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:33
The currently open page.
openPageKey
readonlyopenPageKey:Subscribable<string>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:31
The key of the currently open page.
pageHistory
protectedreadonlypageHistory:ViewEntry<UiView<UiViewProps,any,any>>[] =[]
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:41
Methods
clearPageHistory()
clearPageHistory():
void
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:237
Clears this view service's page history.
Returns
void
clearStack()
protectedclearStack(closePage):void
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:259
Closes all open views and clears the stack.
Parameters
| Parameter | Type | Description |
|---|---|---|
closePage | boolean | Whether to close the currently open page, if one exists. |
Returns
void
closeActiveView()
closeActiveView():
void
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:244
Closes the currently active view.
Returns
void
closeAllViews()
closeAllViews():
void
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:251
Closes all open views except for the currently open page, if one exists.
Returns
void
getOpenViews()
getOpenViews(): readonly
UiView<UiViewProps,any,any>[]
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:96
Gets an array of all currently open views.
Returns
readonly UiView<UiViewProps, any, any>[]
an array of all currently open views.
onInteractionEvent()
protectedonInteractionEvent(hEvent):boolean
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:67
Routes the HEvents to the views.
Parameters
| Parameter | Type | Description |
|---|---|---|
hEvent | string | The event identifier. |
Returns
boolean
whether the event was handled
open()
open<
T>(type,isSubView):T
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:120
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
| Type Parameter | Default type |
|---|---|
T extends UiView<UiViewProps, any, any> | UiView<UiViewProps, any, any> |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
type | string | undefined | The type of the view to open. |
isSubView | boolean | false | A 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.
openLastPage()
openLastPage():
null|UiPage<UiPageProps>
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:223
Opens the page that was most recently closed.
Returns
null | UiPage<UiPageProps>
The page that was opened.
registerView()
registerView(
type?,vnodeFn?):void
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:105
Registers a view with the service.
Parameters
| Parameter | Type | Description |
|---|---|---|
type? | string | The type of the view. |
vnodeFn? | () => VNode | A function creating the VNode. |
Returns
void
routeInteractionEventToViews()
protectedrouteInteractionEventToViews(evt):boolean
Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/ViewService.ts:84
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
| Parameter | Type | Description |
|---|---|---|
evt | FmsHEvent | An interaction event. |
Returns
boolean
Whether the event was handled.