Class: FmcScreen<P, E>
An FMC screen.
This is the main object used to encapsulate an FMC screen and its rendering.
Type parameter T
should be a subclass of the AbstractFmcPage that is universally used by pages in this implementation.
This is done so that different avionics can have different types for different kinds of events and any data that pages might need to be
instantiated with.
Type parameters
Name | Type |
---|---|
P | extends AbstractFmcPage = AbstractFmcPage |
E | Record <string , unknown > |
Implements
FmcScreenPluginContext
<P
,E
>
Constructors
constructor
• new FmcScreen<P
, E
>(bus
, pageFactory
, options
, renderer
, scratchpad
): FmcScreen
<P
, E
>
Ctor
Type parameters
Name | Type |
---|---|
P | extends AbstractFmcPage <any > = AbstractFmcPage <any > |
E | Record <string , unknown > |
Parameters
Name | Type | Description |
---|---|---|
bus | EventBus | the event bus |
pageFactory | FmcPageFactory <P > | the page factory to be used for creating FMC pages for this screen |
options | FmcScreenOptions | the screen options |
renderer | FmcRenderer | the renderer to use for this screen |
scratchpad | FmcScratchpad | the scratchpad to use for this screen |
Returns
FmcScreen
<P
, E
>
Defined in
src/sdk/fmc/FmcScreen.ts:99
Properties
bus
• Protected
Readonly
bus: EventBus
the event bus
Defined in
src/sdk/fmc/FmcScreen.ts:100
currentlyDisplayedPage
• Protected
currentlyDisplayedPage: null
| P
= null
Defined in
src/sdk/fmc/FmcScreen.ts:83
options
• Readonly
options: Required
<FmcScreenOptions
>
Defined in
src/sdk/fmc/FmcScreen.ts:71
scratchpad
• Readonly
scratchpad: FmcScratchpad
the scratchpad to use for this screen
Defined in
src/sdk/fmc/FmcScreen.ts:104
Accessors
currentRoute
• get
currentRoute(): Subject
<string
>
Gets the current route
Returns
Subject
<string
>
a string subject
Defined in
src/sdk/fmc/FmcScreen.ts:138
currentSubpageCount
• get
currentSubpageCount(): Subject
<number
>
Gets the current number of subpages for the current displayed page
Returns
Subject
<number
>
a number
Defined in
src/sdk/fmc/FmcScreen.ts:156
currentSubpageIndex
• get
currentSubpageIndex(): Subject
<number
>
Gets the current subpage index for the current displayed page, 1-indexed
Returns
Subject
<number
>
a number
Defined in
src/sdk/fmc/FmcScreen.ts:147
Methods
acceptPageOutput
▸ acceptPageOutput(output
, template
, atRowIndex
): void
Method called when a page is rendered to the screen. This can be overridden to intercept the page data and act upon it.
Parameters
Name | Type | Description |
---|---|---|
output | FmcOutputTemplate | the output template, displayed on the screen |
template | FmcRenderTemplate | the render template, rendered by the page |
atRowIndex | number | the row index at which the render occurred |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:400
addLskEvents
▸ addLskEvents(array
): void
Adds a list of LSK events bound to certain positions on the rendering grid
Parameters
Name | Type | Description |
---|---|---|
array | [event: keyof E & string, row: number, col: number][] | the LSK events and their positions |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:329
addPageRoute
▸ addPageRoute<T
>(route
, page
, routeEvent?
): void
Declares a route for a page class
Type parameters
Name | Type |
---|---|
T | extends null |
Parameters
Name | Type | Description |
---|---|---|
route | string | the route to set |
page | PageConstructor <P & AbstractFmcPage <T >, null > | the page to associate with it |
routeEvent? | keyof E & string | the event to associate with it |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:251
▸ addPageRoute<U
>(route
, page
, routeEvent
, defaultProps
): void
Declares a route for a page class
Type parameters
Name | Type |
---|---|
U | extends PageConstructor <P , null > |
Parameters
Name | Type | Description |
---|---|---|
route | string | the route to set |
page | U | the page to associate with it |
routeEvent | undefined | keyof E & string | the event to associate with it |
defaultProps | U extends PageConstructor <AbstractFmcPage <V >, V > ? V : never | default props to pass in to the page |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:264
addPagingEvents
▸ addPagingEvents(events
): void
Adds paging events bound the page slewing
Parameters
Name | Type | Description |
---|---|---|
events | FmcPagingEvents <E > | the events to bind |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:342
addPluginPageRoute
▸ addPluginPageRoute<T
>(route
, page
, routeEvent?
, defaultTypedParameters?
): void
Type parameters
Name | Type |
---|---|
T | extends object |
Parameters
Name | Type |
---|---|
route | string |
page | PageConstructor <P & AbstractFmcPage <T >, T > |
routeEvent? | keyof E & string |
defaultTypedParameters? | T |
Returns
void
Inherit Doc
Implementation of
FmcScreenPluginContext.addPluginPageRoute
Defined in
src/sdk/fmc/FmcScreen.ts:299
attachPageExtension
▸ attachPageExtension(pageClass
, extensionCtor
): void
Attaches a FmcPageExtension to a specific page class
Parameters
Name | Type | Description |
---|---|---|
pageClass | PageConstructor <P , null > | the page constructor (class) to attach the extension to |
extensionCtor | (...args : any []) => AbstractFmcPageExtension <P > | the extension class (will be instantiated whenever the page is created) |
Returns
void
Implementation of
FmcScreenPluginContext.attachPageExtension
Defined in
src/sdk/fmc/FmcScreen.ts:319
clearScratchpad
▸ clearScratchpad(): void
Clears the scratchpad, if applicable
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:240
editOutputTemplate
▸ editOutputTemplate(rowIndex
, output
): void
Edits part of the screen output
Parameters
Name | Type | Description |
---|---|---|
rowIndex | number | the row index to insert at |
output | FmcOutputTemplate | the output to insert |
Returns
void
Throws
if rowIndex
is too high
Defined in
src/sdk/fmc/FmcScreen.ts:368
navigateTo
▸ navigateTo(route
, params?
): void
Navigates to a given route and displays the associated page, if available
Parameters
Name | Type | Description |
---|---|---|
route | string | the route |
params? | Record <string , unknown > | the parameters to pass to the page |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:166
▸ navigateTo<U
>(pageClass
, props
): void
Navigates to a given route and displays the associated page, if available
Type parameters
Name | Type |
---|---|
U | extends PageConstructor <P , null > |
Parameters
Name | Type | Description |
---|---|---|
pageClass | U | the page's class |
props | U extends PageConstructor <AbstractFmcPage <V >, V > ? V : never | props to pass in to the page |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:176
onLineSelectKeyError
▸ onLineSelectKeyError(error
): void
Called when an LSK error is thrown. Sets this.scratchpad.errorContents
(if error is a string; otherwise throws) by default.
Parameters
Name | Type | Description |
---|---|---|
error | any | the LSK error |
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:466
onLineSelectKeyUnhandled
▸ onLineSelectKeyUnhandled(selectKeyEvent
): void
Called when an LSK event is not handled by any code.
Parameters
Name | Type | Description |
---|---|---|
selectKeyEvent | LineSelectKeyEvent | the LSK event |
Returns
void
Throws
the value of options.lskNotHandledThrowValue
by default
Defined in
src/sdk/fmc/FmcScreen.ts:456
onPrefixedEvent
▸ onPrefixedEvent<k
>(event
): Consumer
<E
[k
]>
Returns a consumer for an event prefixed for this particular screen.
Type parameters
Name | Type |
---|---|
k | extends string |
Parameters
Name | Type | Description |
---|---|---|
event | k | The event to subscribe to. |
Returns
Consumer
<E
[k
]>
A consumer for an event prefixed for this particular screen.
Defined in
src/sdk/fmc/FmcScreen.ts:356
processPluginPageAdditions
▸ processPluginPageAdditions(): void
Processes page replacement calls made by plugins. Must be called after plugins are initialized, and before stock routes are added.
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:118
processPluginPageReplacements
▸ processPluginPageReplacements(): void
Processes page replacement calls made by plugins. Must be called after plugins are initialized, and after stock routes are added.
Returns
void
Defined in
src/sdk/fmc/FmcScreen.ts:127
replacePageRoute
▸ replacePageRoute<T
>(route
, page
, routeEvent?
, defaultTypedParameters?
): void
Adds a page route to the FMC screen. Has priority over routes added by the avionics.
Type parameters
Name | Type |
---|---|
T | extends object |
Parameters
Name | Type | Description |
---|---|---|
route | string | the route |
page | PageConstructor <P & AbstractFmcPage <T >, T > | the page constructor |
routeEvent? | keyof E & string | the FMC event, optionally, to bind the route to |
defaultTypedParameters? | T | - |
Returns
void
Implementation of
FmcScreenPluginContext.replacePageRoute
Defined in
src/sdk/fmc/FmcScreen.ts:309