very basic javascript undo/redo stack for managing histories