Is dirty flag available in codemirror?

We are using code mirror version 5.49.2. Does code mirror have an api or a flag to check if the code in the editor is dirty or in other words, if the user has edited the code in the editor? I am not looking at the ‘change’ event listener, which I understand will launch everytime there is a change, while what i am looking at is, if there is an api which can be called when required, to find out if the code is dirty.
Thanks in advance.

Look at the changeGeneration and isClean methods.

Thanks for the reply. Will check