illustrious/state

Types

The decoder function which takes in a JSON-decoded dynamic from the initializer or server loader and returns an effect which can be executed in order to populate the application state before rendering

pub type Decoder(action) =
  fn(Dynamic) ->
    Result(IllustriousAction(action), dynamic.DecodeErrors)

The internal action/message type which is used by the illustrious application.

pub type IllustriousAction(orig_action) {
  Perform(orig_action)
  GoTo(path: String)
  Redirect(path: String)
  Back
  Forward
  SetPath(parsed_path: Path)
  Noop
  All(List(IllustriousAction(orig_action)))
}

Constructors

  • Perform(orig_action)
  • GoTo(path: String)
  • Redirect(path: String)
  • Back
  • Forward
  • SetPath(parsed_path: Path)
  • Noop
  • All(List(IllustriousAction(orig_action)))

The internal state/model which is used by the illustrious application to track its own route state as well as your own state.

pub type IllustriousModel(model) {
  IllustriousModel(route: Path, inner_model: model)
}

Constructors

  • IllustriousModel(route: Path, inner_model: model)

The application path, split by each directory separator (/)

pub type Path =
  List(String)

The updater function takes in the current application state and an action and returns the new application state and an effect (possibly the none effect) which get executed

pub type Updater(model, action) =
  fn(model, action) ->
    #(model, Effect(IllustriousAction(action)))
Search Document