Skip to main content

Class: FmcRouter<T>

A router for an FMC screen.

This registers routes and handles setting the appropriate page and params.

Type parameters

NameType
Textends AbstractFmcPage<any>

Constructors

constructor

new FmcRouter<T>(): FmcRouter<T>

Type parameters

NameType
Textends AbstractFmcPage<any>

Returns

FmcRouter<T>

Properties

currentRoute

currentRoute: Subject<string>

Defined in

src/sdk/fmc/FmcRouter.ts:14


currentSubpageCount

currentSubpageCount: Subject<number>

Defined in

src/sdk/fmc/FmcRouter.ts:18


currentSubpageIndex

currentSubpageIndex: Subject<number>

Defined in

src/sdk/fmc/FmcRouter.ts:16

Methods

addRoute

addRoute<P>(route, page, defaultProps): void

Adds a route to the router

Type parameters

NameType
Pextends null | object

Parameters

NameTypeDescription
routestringthe route string
pagePageConstructor<T, P>the target page constructor
defaultPropsPthe default props to pass in to the page

Returns

void

Defined in

src/sdk/fmc/FmcRouter.ts:27


getDefaultPropsForPage

getDefaultPropsForPage<P>(page): P extends PageConstructor<AbstractFmcPage<V>, V> ? V : never

Returns the default props for a given page class

Type parameters

NameType
Pextends PageConstructor<T, null>

Parameters

NameTypeDescription
pagePthe page class

Returns

P extends PageConstructor<AbstractFmcPage<V>, V> ? V : never

the default props

Throws

if the page was not registered

Defined in

src/sdk/fmc/FmcRouter.ts:80


getPageForRoute

getPageForRoute(routeString): undefined | PageConstructor<T, any>

Gets the associated page (or undefined) for a route

Parameters

NameTypeDescription
routeStringstringthe route string

Returns

undefined | PageConstructor<T, any>

the associated page

Defined in

src/sdk/fmc/FmcRouter.ts:39


getRouteForPage

getRouteForPage(pageCtor): undefined | string

Gets the associated route (or undefined) for a page

Parameters

NameTypeDescription
pageCtorPageConstructor<T, any>the page constructor

Returns

undefined | string

the associated route

Defined in

src/sdk/fmc/FmcRouter.ts:50


getSubpageForRoute

getSubpageForRoute(routeString): number

Gets the associated subpage index (after the hash) or 1 by default

Parameters

NameTypeDescription
routeStringstringthe route string

Returns

number

the associated subpage index

Defined in

src/sdk/fmc/FmcRouter.ts:67


nextSubpage

nextSubpage(): boolean

Moves to the next subpage if there is one available

Returns

boolean

whether or not the subpage was changed

Defined in

src/sdk/fmc/FmcRouter.ts:110


prevSubpage

prevSubpage(): boolean

Moves to the previous subpage if there is one available

Returns

boolean

whether or not the subpage was changed

Defined in

src/sdk/fmc/FmcRouter.ts:93


setSubpage

setSubpage(index): boolean

Moves to the specified subpage if there is one available

Parameters

NameTypeDescription
indexnumberDesired subpage index (1-based)

Returns

boolean

whether or not the subpage was changed

Defined in

src/sdk/fmc/FmcRouter.ts:129