← Back to design patterns mapbehavioral
💾
Design Pattern
Memento
Capture and restore object state without exposing internals.
Visual Diagram
state now -> save snapshot -> changes -> restore snapshot
When To Use
- ->Editor undo history
- ->Draft snapshots
- ->Session restore
- ->Rollback state in workflows
Used in: Undo history, drafts, editor snapshots
memento.js
Live Editor
Loading...
Output
Run code to see output...