This started out as a question but in the process of asking it I figured out the answer. However since it's not well documented (that I could find anyway) I'm posting here for anyone else that comes along with the same issue.
I'm using the Autodesk Forge Viewer with the Edit2D tools. I see that in the default context it has an undo stack. I can subscribe and get a notification when the undo stack changes like this:
// @ts-ignore
e.defaultContext.undoStack.addEventListener(Autodesk.Edit2D.UndoStack.BEFORE_ACTION, s => {
console.log(s);
});
// @ts-ignore
e.defaultContext.undoStack.addEventListener(Autodesk.Edit2D.UndoStack.AFTER_ACTION, s => {
console.log(s);
});
However I want to tell the viewer to simply undo the last action and I can't find any documentation on how to do that. How do I implement an undo? If there is a documentation file or page somewhere that shows more data about the undo stack system?