brazier/local

Types

A client-only state layer over the synced model.

pub opaque type Layer(model, local, msg)

The result of a local update.

pub opaque type Update(local)

Values

pub fn forward(local: local) -> Update(local)

Apply local in the browser and also send the message to the server.

pub fn handled(local: local) -> Update(local)

Apply local in the browser and do not send the message to the server.

pub fn layer(
  init init: fn(model) -> local,
  update update: fn(model, local, msg) -> Update(local),
) -> Layer(model, local, msg)

A layer with init (run once, in the browser, with the first synced model) and update.

pub fn none() -> Layer(model, Nil, msg)

No client-only state. Every message goes to the server.

✨ Search Document