Skip to content

Interface: HistoryStore

@roomful/svelte


@roomful/svelte / HistoryStore

Defined in: packages/svelte/src/index.ts:555

Readable store of the shared collaborative history timeline augmented with reactive canUndo/canRedo stores and the undo/redo controls. The store’s own value is the timeline (oldest first), updating on any local or remote timeline change.

canRedo: Readable<boolean>

Defined in: packages/svelte/src/index.ts:566

A readable store reporting whether the local peer has an undone transaction to redo.


canUndo: Readable<boolean>

Defined in: packages/svelte/src/index.ts:560

A readable store reporting whether the local peer has a tracked transaction to undo.


capture: (action, payload?) => void

Defined in: packages/svelte/src/index.ts:571

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: packages/svelte/src/index.ts:586

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.


transaction: (name, fn) => void

Defined in: packages/svelte/src/index.ts:576

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: packages/svelte/src/index.ts:581

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.

subscribe(this, run, invalidate?): Unsubscriber

Defined in: node_modules/.pnpm/svelte@4.2.20/node_modules/svelte/types/index.d.ts:1619

Subscribe on value changes.

void

Subscriber<TimelineEntry[]>

subscription callback

Invalidator<TimelineEntry[]>

cleanup callback

Unsubscriber

Readable.subscribe