Skip to main content

Class: FmcScreen<P, E>

Defined in: src/sdk/fmc/FmcScreen.ts:91

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.

Extended by​

Type Parameters​

Type ParameterDefault type
P extends AbstractFmcPageAbstractFmcPage
ERecord<string, unknown>

Implements​

Constructors​

Constructor​

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

Defined in: src/sdk/fmc/FmcScreen.ts:124

Ctor

Parameters​

ParameterTypeDescription
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>

Properties​

bus​

protected readonly bus: EventBus

Defined in: src/sdk/fmc/FmcScreen.ts:125

the event bus


currentlyDisplayedPage​

protected currentlyDisplayedPage: P | null = null

Defined in: src/sdk/fmc/FmcScreen.ts:108


options​

readonly options: Required<FmcScreenOptions>

Defined in: src/sdk/fmc/FmcScreen.ts:96


scratchpad​

readonly scratchpad: FmcScratchpad

Defined in: src/sdk/fmc/FmcScreen.ts:129

the scratchpad to use for this screen

Accessors​

currentRoute​

Get Signature​

get currentRoute(): Subject<string>

Defined in: src/sdk/fmc/FmcScreen.ts:163

Gets the current route

Returns​

Subject<string>

a string subject


currentSubpageCount​

Get Signature​

get currentSubpageCount(): Subject<number>

Defined in: src/sdk/fmc/FmcScreen.ts:181

Gets the current number of subpages for the current displayed page

Returns​

Subject<number>

a number


currentSubpageIndex​

Get Signature​

get currentSubpageIndex(): Subject<number>

Defined in: src/sdk/fmc/FmcScreen.ts:172

Gets the current subpage index for the current displayed page, 1-indexed

Returns​

Subject<number>

a number

Methods​

acceptPageOutput()​

protected acceptPageOutput(output, template, atRowIndex): void

Defined in: src/sdk/fmc/FmcScreen.ts:429

Method called when a page is rendered to the screen. This can be overridden to intercept the page data and act upon it.

Parameters​

ParameterTypeDescription
outputFmcOutputTemplatethe output template, displayed on the screen
templateFmcRenderTemplatethe render template, rendered by the page
atRowIndexnumberthe row index at which the render occurred

Returns​

void


addLskEvents()​

addLskEvents(array): void

Defined in: src/sdk/fmc/FmcScreen.ts:358

Adds a list of LSK events bound to certain positions on the rendering grid

Parameters​

ParameterTypeDescription
array[keyof E & string, number, number][]the LSK events and their positions

Returns​

void


addPageRoute()​

Declares a route for a page class

Param​

the route to set

Param​

the page to associate with it

Param​

the event to associate with it

Param​

default typed parameters to pass in to the page

Call Signature​

addPageRoute<T>(route, page, routeEvent?): void

Defined in: src/sdk/fmc/FmcScreen.ts:280

Declares a route for a page class

Type Parameters​
Type Parameter
T extends object | null
Parameters​
ParameterTypeDescription
routestringthe route to set
pagePageConstructor<P & AbstractFmcPage<T>>the page to associate with it
routeEvent?keyof E & stringthe event to associate with it
Returns​

void

Call Signature​

addPageRoute<U>(route, page, routeEvent, defaultProps): void

Defined in: src/sdk/fmc/FmcScreen.ts:293

Declares a route for a page class

Type Parameters​
Type Parameter
U extends PageConstructor<P, null>
Parameters​
ParameterTypeDescription
routestringthe route to set
pageUthe page to associate with it
routeEventkeyof E & string | undefinedthe event to associate with it
defaultPropsU extends PageConstructor<AbstractFmcPage<V>, V> ? V : neverdefault props to pass in to the page
Returns​

void


addPagingEvents()​

addPagingEvents(events): void

Defined in: src/sdk/fmc/FmcScreen.ts:371

Adds paging events bound the page slewing

Parameters​

ParameterTypeDescription
eventsFmcPagingEvents<E>the events to bind

Returns​

void


addPluginPageRoute()​

addPluginPageRoute<T>(route, page, routeEvent?, defaultTypedParameters?): void

Defined in: src/sdk/fmc/FmcScreen.ts:328

Type Parameters​

Type Parameter
T extends object

Parameters​

ParameterType
routestring
pagePageConstructor<P & AbstractFmcPage<T>, T>
routeEvent?keyof E & string
defaultTypedParameters?T

Returns​

void

Inherit Doc​

Implementation of​

FmcScreenPluginContext.addPluginPageRoute


attachPageExtension()​

attachPageExtension(pageClass, extensionCtor): void

Defined in: src/sdk/fmc/FmcScreen.ts:348

Attaches a FmcPageExtension to a specific page class

Parameters​

ParameterTypeDescription
pageClassPageConstructor<P>the page constructor (class) to attach the extension to
extensionCtor(...args) => AbstractFmcPageExtension<P>the extension class (will be instantiated whenever the page is created)

Returns​

void

Implementation of​

FmcScreenPluginContext.attachPageExtension


clearScratchpad()​

clearScratchpad(): void

Defined in: src/sdk/fmc/FmcScreen.ts:269

Clears the scratchpad, if applicable

Returns​

void


editOutputTemplate()​

editOutputTemplate(rowIndex, output): void

Defined in: src/sdk/fmc/FmcScreen.ts:397

Edits part of the screen output

Parameters​

ParameterTypeDescription
rowIndexnumberthe row index to insert at
outputFmcOutputTemplatethe output to insert

Returns​

void

Throws​

if rowIndex is too high


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

Param​

the route

Param​

the parameters to pass to the page

Throws​

if a page class is passed in as the first argument and no associated route is found

Call Signature​

navigateTo(route, params?): void

Defined in: src/sdk/fmc/FmcScreen.ts:191

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

Parameters​
ParameterTypeDescription
routestringthe route
params?Record<string, unknown>the parameters to pass to the page
Returns​

void

Call Signature​

navigateTo<U>(pageClass, props): void

Defined in: src/sdk/fmc/FmcScreen.ts:201

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

Type Parameters​
Type Parameter
U extends PageConstructor<P, null>
Parameters​
ParameterTypeDescription
pageClassUthe page's class
propsU extends PageConstructor<AbstractFmcPage<V>, V> ? V : neverprops to pass in to the page
Returns​

void


onLineSelectKeyError()​

protected onLineSelectKeyError(error): void

Defined in: src/sdk/fmc/FmcScreen.ts:495

Called when an LSK error is thrown. Sets this.scratchpad.errorContents (if error is a string; otherwise throws) by default.

Parameters​

ParameterTypeDescription
erroranythe LSK error

Returns​

void


onLineSelectKeyUnhandled()​

protected onLineSelectKeyUnhandled(selectKeyEvent): void

Defined in: src/sdk/fmc/FmcScreen.ts:485

Called when an LSK event is not handled by any code.

Parameters​

ParameterTypeDescription
selectKeyEventLineSelectKeyEventthe LSK event

Returns​

void

Throws​

the value of options.lskNotHandledThrowValue by default


onPrefixedEvent()​

onPrefixedEvent<k>(event): Consumer<E[k]>

Defined in: src/sdk/fmc/FmcScreen.ts:385

Returns a consumer for an event prefixed for this particular screen.

Type Parameters​

Type Parameter
k extends string

Parameters​

ParameterTypeDescription
eventkThe event to subscribe to.

Returns​

Consumer<E[k]>

A consumer for an event prefixed for this particular screen.


processPluginPageAdditions()​

processPluginPageAdditions(): void

Defined in: src/sdk/fmc/FmcScreen.ts:143

Processes page replacement calls made by plugins. Must be called after plugins are initialized, and before stock routes are added.

Returns​

void


processPluginPageReplacements()​

processPluginPageReplacements(): void

Defined in: src/sdk/fmc/FmcScreen.ts:152

Processes page replacement calls made by plugins. Must be called after plugins are initialized, and after stock routes are added.

Returns​

void


replacePageRoute()​

replacePageRoute<T>(route, page, routeEvent?, defaultTypedParameters?): void

Defined in: src/sdk/fmc/FmcScreen.ts:338

Adds a page route to the FMC screen. Has priority over routes added by the avionics.

Type Parameters​

Type Parameter
T extends object

Parameters​

ParameterTypeDescription
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