Interface: UseHistoryResult
@roomful/react / UseHistoryResult
Interface: UseHistoryResult
Section titled “Interface: UseHistoryResult”Defined in: react/src/index.ts:429
Describes the return value of useHistory.
Properties
Section titled “Properties”canRedo
Section titled “canRedo”canRedo:
boolean
Defined in: react/src/index.ts:444
Reports whether the local peer has an undone transaction to redo. Reactive.
canUndo
Section titled “canUndo”canUndo:
boolean
Defined in: react/src/index.ts:439
Reports whether the local peer has a tracked transaction to undo. Reactive.
capture()
Section titled “capture()”capture: (
action,payload?) =>void
Defined in: react/src/index.ts:449
Records a timeline entry without wrapping a mutation.
Records a timeline entry without wrapping any mutation. Use this to log an
action that the app applies itself; pair it with transaction when the
action should also be undoable.
Parameters
Section titled “Parameters”action
Section titled “action”string
The action label for the entry.
payload?
Section titled “payload?”unknown
Optional metadata; a string is used as the entry
description, otherwise the description defaults to action.
Returns
Section titled “Returns”void
Nothing.
redo()
Section titled “redo()”redo: () =>
Promise<void>
Defined in: react/src/index.ts:464
Redoes the local peer’s most recently undone transaction.
Redoes the local peer’s most recently undone transaction.
Returns
Section titled “Returns”Promise<void>
A promise that resolves once the redo is applied.
timeline
Section titled “timeline”timeline:
TimelineEntry[]
Defined in: react/src/index.ts:434
Exposes the shared timeline of every peer’s entries, oldest first. Reactive: re-renders on any local or remote timeline change.
transaction()
Section titled “transaction()”transaction: (
name,fn) =>void
Defined in: react/src/index.ts:454
Runs a function, capturing its shared-CRDT mutations as one undoable entry.
Runs fn, capturing every shared-CRDT mutation it makes as a single
undoable timeline entry. The mutations are committed under the local peer’s
tracked transaction origin so a later undo() reverts exactly this unit.
Parameters
Section titled “Parameters”string
The action label recorded on the timeline entry.
() => void
The function whose mutations form one undoable unit.
Returns
Section titled “Returns”void
Nothing.
undo()
Section titled “undo()”undo: () =>
Promise<void>
Defined in: react/src/index.ts:459
Undoes the local peer’s most recent tracked transaction.
Undoes the local peer’s most recent tracked transaction, reverting only that peer’s changes to the shared CRDT document.
Returns
Section titled “Returns”Promise<void>
A promise that resolves once the undo is applied.