How would you build a counter with a history of the values and ability to undo/redo actions?

Technical