Class: FmcRouter<T>
A router for an FMC screen.
This registers routes and handles setting the appropriate page and params.
Type parameters
Name | Type |
---|---|
T | extends AbstractFmcPage <any > |
Constructors
constructor
• new FmcRouter<T
>(): FmcRouter
<T
>
Type parameters
Name | Type |
---|---|
T | extends 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
Name | Type |
---|---|
P | extends null | object |
Parameters
Name | Type | Description |
---|---|---|
route | string | the route string |
page | PageConstructor <T , P > | the target page constructor |
defaultProps | P | the 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
Name | Type |
---|---|
P | extends PageConstructor <T , null > |
Parameters
Name | Type | Description |
---|---|---|
page | P | the 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
Name | Type | Description |
---|---|---|
routeString | string | the 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
Name | Type | Description |
---|---|---|
pageCtor | PageConstructor <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
Name | Type | Description |
---|---|---|
routeString | string | the 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
Name | Type | Description |
---|---|---|
index | number | Desired subpage index (1-based) |
Returns
boolean
whether or not the subpage was changed
Defined in
src/sdk/fmc/FmcRouter.ts:129