# An event emitted for undo.

**URL:** <https://discuss.codemirror.net/t/an-event-emitted-for-undo/4753>\
**Category:** v6\
**Created:** [July 25, 2022, 6:00pm UTC](https://discuss.codemirror.net/t/an-event-emitted-for-undo/4753 "2022-07-25T18:00:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gawaliashish924](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/g/71e660/32.png) [@gawaliashish924](https://discuss.codemirror.net/u/gawaliashish924)\
**Post date:** [July 25, 2022, 6:00pm UTC](https://discuss.codemirror.net/t/an-event-emitted-for-undo/4753/1 "2022-07-25T18:00:26Z")

</div>

I would like to catch an undo event and do some changes according to it. Is there a event I should be listening to for the same.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [July 25, 2022, 7:37pm UTC](https://discuss.codemirror.net/t/an-event-emitted-for-undo/4753/2 "2022-07-25T19:37:34Z")

</div>

What kind of changes? You can check for transactions with an `"undo"` [user event](https://codemirror.net/docs/ref/#state.Transaction%5EuserEvent), but you can’t modify undo transactions, since that would break the history state.
