fn
createWritekit
testedCreate an Writekit around an initial state.
Signature
ts
export function createWritekit(options: CreateWritekitOptions): Writekit{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
options | CreateWritekitOptions | — |
Returns
Writekit| Property | Type | Description |
|---|---|---|
state | WritekitState | — |
dispatch | Dispatch | — |
command | (cmd: Command) => boolean | Run 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 | — |