LivePanels.Canvas.Transaction (livepanels v0.1.0)

Copy Markdown View Source

Command composition context for one socket-bound canvas mutation.

LivePanels.Canvas.transaction/2 and LivePanels.Canvas.transaction!/2 pass this context to ordinary owner modules. The owner modules append command values while the context keeps a preview of the evolving canvas state, so derived actions such as move and resize can compose with earlier commands in the same transaction.

Application code should not construct this struct directly. Use LivePanels.Canvas.transaction/2 to receive a result tuple or LivePanels.Canvas.transaction!/2 to receive the socket or raise; LivePanels creates the transaction context and passes it to the callback.

Summary

Types

t()

Transaction context passed to LivePanels.Canvas.transaction/2 callbacks.

Types

t()

@type t() :: %LivePanels.Canvas.Transaction{
  actor: term(),
  command_type: term(),
  commands: term(),
  commit_result_runner: term(),
  normalize_command: term(),
  preview_command: term(),
  rejected: term(),
  socket: term(),
  state: term()
}

Transaction context passed to LivePanels.Canvas.transaction/2 callbacks.