Skip to content
On this page

History Store

Pinia store that tracks an interaction history with a do and an undo stack.

State

NameDescriptionTypeValuesDefault
menuwhether to show the menuboolean[true, false]false
undoStacklist of action that were donearray-[]
redoStacklist of action that were undonearray-[]

Methods

do

Tell the history that an action has been performed and store it in the history.
@param {String} desc - description of the action
@param {Function} doAction - function that has been performed
@param {Function} undoAction - function that will be called on undo

undo

Tell the history to undo the last action. This will call the undoAction stored for the last action and push this action to the redo stack.

redo

Redo the last action that was undo (if available). This will pop the action from the redo stack and push it back to the undo stack.

clear

Clears all interactions from the history

setMenu

Whether to show the history menu/drawer
@param {Boolean} value - show if true; else hide