lustre

To read the full documentation for this module, please visit https://lustre.build/api/lustre

Types

pub opaque type App(flags, model, msg)
pub type Error {
  AppAlreadyStarted
  AppNotYetStarted
  BadComponentName
  ComponentAlreadyRegistered
  ElementNotFound
  NotABrowser
}

Constructors

  • AppAlreadyStarted
  • AppNotYetStarted
  • BadComponentName
  • ComponentAlreadyRegistered
  • ElementNotFound
  • NotABrowser

Functions

pub fn application(
  init: fn(a) -> #(b, Effect(c)),
  update: fn(b, c) -> #(b, Effect(c)),
  view: fn(b) -> Element(c),
) -> App(a, b, c)
pub fn component(
  name: String,
  init: fn() -> #(a, Effect(b)),
  update: fn(a, b) -> #(a, Effect(b)),
  view: fn(a) -> Element(b),
  on_attribute_change: Dict(
    String,
    fn(Dynamic) -> Result(b, List(DecodeError)),
  ),
) -> Result(Nil, Error)
pub fn destroy(app: App(a, b, c)) -> Result(Nil, Error)
pub fn element(element: Element(a)) -> App(Nil, Nil, a)
pub fn is_browser() -> Bool
pub fn is_registered(name: String) -> Bool
pub fn simple(
  init: fn(a) -> b,
  update: fn(b, c) -> b,
  view: fn(b) -> Element(c),
) -> App(a, b, c)
pub fn start(
  app: App(a, b, c),
  selector: String,
  flags: a,
) -> Result(fn(c) -> Nil, Error)
Search Document