Skip to main content

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

NameType
Pextends AbstractFmcPage = AbstractFmcPage
ERecord<string, unknown>

Implements

Constructors

constructor

new FmcScreen<P, E>(bus, pageFactory, options, renderer, scratchpad): FmcScreen<P, E>

Ctor

Type parameters

NameType
Pextends AbstractFmcPage<any> = AbstractFmcPage<any>
ERecord<string, unknown>

Parameters

NameTypeDescription
busEventBusthe event bus
pageFactoryFmcPageFactory<P>the page factory to be used for creating FMC pages for this screen
optionsFmcScreenOptionsthe screen options
rendererFmcRendererthe renderer to use for this screen
scratchpadFmcScratchpadthe 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

NameTypeDescription
outputFmcOutputTemplatethe output template, displayed on the screen
templateFmcRenderTemplatethe render template, rendered by the page
atRowIndexnumberthe 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

NameTypeDescription
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

NameType
Textends null

Parameters

NameTypeDescription
routestringthe route to set
pagePageConstructor<P & AbstractFmcPage<T>, null>the page to associate with it
routeEvent?keyof E & stringthe 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

NameType
Uextends PageConstructor<P, null>

Parameters

NameTypeDescription
routestringthe route to set
pageUthe page to associate with it
routeEventundefined | keyof E & stringthe event to associate with it
defaultPropsU extends PageConstructor<AbstractFmcPage<V>, V> ? V : neverdefault 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

NameTypeDescription
eventsFmcPagingEvents<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

NameType
Textends object

Parameters

NameType
routestring
pagePageConstructor<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

NameTypeDescription
pageClassPageConstructor<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

NameTypeDescription
rowIndexnumberthe row index to insert at
outputFmcOutputTemplatethe output to insert

Returns

void

Throws

if rowIndex is too high

Defined in

src/sdk/fmc/FmcScreen.ts:368


navigateTo(route, params?): void

Navigates to a given route and displays the associated page, if available

Parameters

NameTypeDescription
routestringthe 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

NameType
Uextends PageConstructor<P, null>

Parameters

NameTypeDescription
pageClassUthe page's class
propsU extends PageConstructor<AbstractFmcPage<V>, V> ? V : neverprops 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

NameTypeDescription
erroranythe 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

NameTypeDescription
selectKeyEventLineSelectKeyEventthe 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

NameType
kextends string

Parameters

NameTypeDescription
eventkThe 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

NameType
Textends object

Parameters

NameTypeDescription
routestringthe route
pagePageConstructor<P & AbstractFmcPage<T>, T>the page constructor
routeEvent?keyof E & stringthe FMC event, optionally, to bind the route to
defaultTypedParameters?T-

Returns

void

Implementation of

FmcScreenPluginContext.replacePageRoute

Defined in

src/sdk/fmc/FmcScreen.ts:309