Examples
Time Machine
Drawing canvas with undo/redo, export/import, replay, and changesets.
Try it
Loading example…
Draw on the canvas, then use Undo/Redo to navigate history. Export to save state as JSON, or use Changesets to group multiple strokes into a single undo step.
How it works
Each brush stroke is a fact mutation captured as a time-travel snapshot. Directive’s built-in HistoryManager provides the full history API.
- Undo / Redo – Navigate through snapshot history with
goBack()andgoForward() - Export / Import – Serialize all snapshots to JSON and restore them later
- Replay – Animate through the entire history to see strokes appear progressively
- Changesets – Group multiple mutations into a single atomic undo step using
beginChangeset()/endChangeset()
Source code
main.ts
// Source file "main.ts" not found

