Skip to content

Interface: UseHistoryResult

@roomful/react


@roomful/react / UseHistoryResult

Defined in: react/src/index.ts:429

Describes the return value of useHistory.

canRedo: boolean

Defined in: react/src/index.ts:444

Reports whether the local peer has an undone transaction to redo. Reactive.


canUndo: boolean

Defined in: react/src/index.ts:439

Reports whether the local peer has a tracked transaction to undo. Reactive.


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.

string

The action label for the entry.

unknown

Optional metadata; a string is used as the entry description, otherwise the description defaults to action.

void

Nothing.


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.

Promise<void>

A promise that resolves once the redo is applied.


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: (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.

string

The action label recorded on the timeline entry.

() => void

The function whose mutations form one undoable unit.

void

Nothing.


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.

Promise<void>

A promise that resolves once the undo is applied.