fn

createWritekit

tested

Create an Writekit around an initial state.

Signature

ts
export function createWritekit(options: CreateWritekitOptions): Writekit{ ... }

Parameters

ParameterTypeDescription
optionsCreateWritekitOptions—

Returns

Writekit
PropertyTypeDescription
stateWritekitState—
dispatchDispatch—
command(cmd: Command) => booleanRun a command against the current state, dispatching if it applies.
undo() => boolean—
redo() => boolean—
canUndo() => boolean—
canRedo() => boolean—
on<K extends keyof WritekitEvents>(event: K, listener: WritekitEvents[K]) => void—
off<K extends keyof WritekitEvents>(event: K, listener: WritekitEvents[K]) => void—
destroy() => void—