Router Module

Functions for building Routers that bind page navigation with Elmish.

Functions and values

Function or value Description

definePageModel pageModel value

Full Usage: definePageModel pageModel value

Parameters:
    pageModel : PageModel<'T> - The PageModel, retrieved from the endpoint passed to the function by M:inferWithModel`3.
    value : 'T - The value of the page model to put inside pageModel.

Define the PageModel for a given endpoint. Must be called inside the defaultPageModel function passed to M:inferWithModel`3.

pageModel : PageModel<'T>

The PageModel, retrieved from the endpoint passed to the function by M:inferWithModel`3.

value : 'T

The value of the page model to put inside pageModel.

infer makeMessage getEndPoint

Full Usage: infer makeMessage getEndPoint

Parameters:
    makeMessage : 'ep -> 'msg - Function that creates the message for switching to the page pointed by an endpoint.
    getEndPoint : 'model -> 'ep - Function that extracts the current endpoint from the Elmish model.

Returns: Router<'ep, 'model, 'msg> A router for the given endpoint type.

Infer a router constructed around an endpoint type . This type must be an F# union type, and its cases should use EndPointAttribute to declare how they match to a URI.

makeMessage : 'ep -> 'msg

Function that creates the message for switching to the page pointed by an endpoint.

getEndPoint : 'model -> 'ep

Function that extracts the current endpoint from the Elmish model.

Returns: Router<'ep, 'model, 'msg>

A router for the given endpoint type.

inferWithModel makeMessage getEndPoint defaultPageModel

Full Usage: inferWithModel makeMessage getEndPoint defaultPageModel

Parameters:
    makeMessage : 'ep -> 'msg - Function that creates the message for switching to the page pointed by an endpoint.
    getEndPoint : 'model -> 'ep - Function that extracts the current endpoint from the Elmish model.
    defaultPageModel : 'ep -> unit - Function that indicates the default PageModel for a given endpoint. Inside this function, call M:definePageModel to indicate the page model to use when switching to a new page.

Returns: Router<'ep, 'model, 'msg> A router for the given endpoint type.

Infer a router constructed around an endpoint type . This type must be an F# union type, and its cases should use EndPointAttribute to declare how they match to a URI.

makeMessage : 'ep -> 'msg

Function that creates the message for switching to the page pointed by an endpoint.

getEndPoint : 'model -> 'ep

Function that extracts the current endpoint from the Elmish model.

defaultPageModel : 'ep -> unit

Function that indicates the default PageModel for a given endpoint. Inside this function, call M:definePageModel to indicate the page model to use when switching to a new page.

Returns: Router<'ep, 'model, 'msg>

A router for the given endpoint type.

noModel

Full Usage: noModel

Returns: PageModel<'T>

An empty PageModel. Used when constructing an endpoint to pass to methods such as Router.

Returns: PageModel<'T>