sprocket/runtime

Types

pub opaque type Message
pub type RenderedUpdate {
  FullUpdate(ReconciledElement)
  PatchUpdate(patch: Patch)
}

Constructors

  • FullUpdate(ReconciledElement)
  • PatchUpdate(patch: Patch)
pub type Runtime =
  Subject(Message)
pub opaque type State

Functions

pub fn get_reconciled(
  actor: Subject(Message),
) -> Option(ReconciledElement)

Get the previously reconciled state from the actor. This is useful for testing.

pub fn process_client_hook(
  actor: Subject(Message),
  id: String,
  event: String,
  payload: Option(Dynamic),
  reply_dispatcher: fn(String, Option(String)) ->
    Result(Nil, Nil),
) -> Nil

Get the client hook for a given id

pub fn process_event(
  actor: Subject(Message),
  id: String,
  payload: Option(String),
) -> Nil

Get the event handler for a given id

pub fn process_event_immediate(
  actor: Subject(Message),
  id: String,
  payload: Option(String),
) -> Result(Nil, Nil)
pub fn reconcile_immediate(
  actor: Subject(Message),
) -> ReconciledElement

Reconcile the view - should only be used for testing purposes

pub fn render_update(actor: Subject(Message)) -> Nil
pub fn start(
  view: Element,
  updater: Updater(RenderedUpdate),
  dispatcher: Option(Dispatcher),
) -> Result(Subject(Message), StartError)

Start a new runtime actor

pub fn stop(actor: Subject(Message)) -> Nil

Stop a runtime actor

Search Document