I want to generate some history states by my extension and I found that I can do this with suspendHistory.
But I also want to do some action when user perform undo action and revert that states. How to catch that event?
Can you explain better what you want to do?
SuspendHistort stops the generation of history states for the commands you use in your sctipt. That makes is easy for a user to undo all that your script does they only have to back up one history state. In a script you can code and interactive Photoshop step and catch if the users cancels it instead of using the step.
You Can not suspend the script give the user control of Photoshop then regain control of Photoshop. You may be able to setup a script manager event for Undo that will get triggered after a user does a manual undo and its been completed. But I would not have any idea what you could do with such a trigger or if you could even figure out how many step the user may have backed up.