This sample creates a custom operation to undo/redo graphics. The custom operation inherits from esri/OperationBase. View the code for the custom operation.
Add a graphic to the map then use the undo/redo buttons to cycle through the operation stack.