Hosted onlinkforest.hyper.mediavia theHypermedia Protocol

Pattern: Undo/Redo

Pattern: Undo / Redo

Build undo/redo functionality with a history stack state machine.

Overview

Undo/redo is a classic stack pattern that maps naturally to a state machine with history states and a stack context.

Key Concepts


    States: canUndo / canRedo / atHead / atTail

    Stack as context with pointer

    Guard: canUndo, canRedo

    Actions: push, undo, redo, clear

Related Pages


TODO


    Add bounded stack machine (max N entries)

    Add group operations (atomic undo)

    Add visual history timeline

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime