Link Search Menu Expand Document

A specialization of Program that handles application navigation via location’s hash.

It uses history package.

Added in v0.5.0


Table of contents


constructors

program

Returns a Program specialized for Navigation.

The Program is a Html.Program but it needs a locationToMsg() function which converts location changes to messages.

Underneath it consumes location$ stream (applying locationToMsg() on its values).

Signature

export declare function program<Model, Msg, Dom>(
  locationToMessage: (location: Location) => Msg,
  init: (location: Location) => [Model, Cmd<Msg>],
  update: (msg: Msg, model: Model) => [Model, Cmd<Msg>],
  view: (model: Model) => html.Html<Dom, Msg>,
  subscriptions: (model: Model) => Sub<Msg> = () => none
): html.Program<Model, Msg, Dom>

Added in v0.5.0

programWithFlags

Same as program() but with Flags that can be passed when the Program is created in order to manage initial values.

Signature

export declare function programWithFlags<Flags, Model, Msg, Dom>(
  locationToMessage: (location: Location) => Msg,
  init: (flags: Flags) => (location: Location) => [Model, Cmd<Msg>],
  update: (msg: Msg, model: Model) => [Model, Cmd<Msg>],
  view: (model: Model) => html.Html<Dom, Msg>,
  subscriptions: (model: Model) => Sub<Msg> = () => none
): (flags: Flags) => html.Program<Model, Msg, Dom>

Added in v0.5.0

model

Location (type alias)

Signature

export type Location = H.Location

Added in v0.5.0

utils

push

Generates a Cmd that adds a new location to the history’s list.

Signature

export declare function push<Msg>(url: string): Cmd<Msg>

Added in v0.5.0