retrace_frontend/client

JavaScript delivery runtime. Capture and application updates remain separate. The host owns start/stop; saved batches drain across runtime restarts.

Types

pub type Client
pub type Config {
  Config(
    endpoint: String,
    queue_name: String,
    max_items: Int,
    max_bytes: Int,
  )
}

Constructors

  • Config(
      endpoint: String,
      queue_name: String,
      max_items: Int,
      max_bytes: Int,
    )
pub type Status {
  Status(queued: Int, acknowledged: Int, detail: String)
}

Constructors

  • Status(queued: Int, acknowledged: Int, detail: String)

A factory that opens caller-owned persistence. Use retrace_frontend/client/adapter to construct one from Gleam operations, or provide an existing FFI adapter.

pub type Storage

An abortable upload returning acknowledgement JSON. Construct one through retrace_frontend/client/adapter or use a provided transport. No reducer runs here.

pub type Transport

Values

pub fn browser_storage() -> Storage
pub fn enqueue(
  client: Client,
  batch: wire.Batch,
  saved: fn(Result(Nil, String)) -> Nil,
) -> Nil

Called after projection. The callback confirms local persistence, not upload. Validation failure does not touch local storage or the network.

pub fn http_transport(endpoint: String) -> Transport
pub fn retry(client: Client) -> Nil
pub fn start(
  config: Config,
  on_status: fn(Status) -> Nil,
) -> Client
pub fn start_with(
  config: Config,
  storage: Storage,
  transport: Transport,
  on_status: fn(Status) -> Nil,
) -> Client

Advanced entrypoint; the caller selects persistence and upload policy.

pub fn stop(client: Client) -> Nil
✨ Search Document