JavaScript Object history (undo/redo)