Fire an event on content change

Hi, I want to fire a custom dom event every time the content of the view changes. What is a good place to put this logic in? At the moment it’s in the ‘update()’ function of one of my plugins, but that’s an overkill as it’s fired every time I click on text. I guess I could compare old and new htmls, but maybe there is a better way? Thanks.

You’ll want to look at transaction.docChanged to determine whether the document actually changed.

Awesome, thank you.