Yex.UndoManager.StackItemEvent (y_ex v0.13.0)

Copy Markdown View Source

A stack item was added, updated or popped. Delivered by Yex.UndoManager.observe/2.

  • :type - :added when a captured change created a new item, :updated when it was merged into the last item (within capture_timeout), :popped when undo/1 or redo/1 applied the item.
  • :kind - for :added and :updated, the stack the item is on: :redo when the change came from an undo, :undo otherwise. For :popped, :undo when popped by undo/1 and :redo when popped by redo/1.
  • :item - the item's id, stable for its whole life. Use it with Yex.UndoManager.put_meta/3 and Yex.UndoManager.get_meta/2.
  • :origin - the origin of the transaction that caused the event: the term given to Yex.Doc.transaction/3, nil, or the %Yex.UndoManager{} for undo and redo.
  • :meta - the item's meta at the time of the event, nil until set.

Summary

Types

t()

@type t() :: %Yex.UndoManager.StackItemEvent{
  item: pos_integer(),
  kind: :undo | :redo,
  meta: term(),
  origin: term(),
  type: :added | :updated | :popped
}