When CodeMirror element structure changes, JS world should be notified.
# After initial page DOM loading, JS generation of hilite layer starts. I want to know when CodeMirror element creation finished.
# When source text changes significantly, I want to get notified. CodeMirror elements may have been created, or entire elements could vanish due to deletions.
Both situations may be reflected by only one event; point 1 is a special case of event 2.
* Single characters amid element content are less important; I could listen change events and follow each keystroke anyway.
In MediaWiki context ##mw.hook()## would be preferred and robust mechanism.
* If non-MediaWiki environment needs to be supported, user defined JS Event() might be triggered.
* One existing feature is drawing attention on errors, here as soon as ##.cm-error## shows up, avoiding saving and leaving before remedied.
* Another interesting issue is the occurrence of certain templates from a list of observed template names, flipping through ##.cm-mw-template-name## and even more if connected with some template parameters which might be deprecated and should be replaced, or evaluating parameter values and warn or fix or format. Grabbing CodeMirror elements might be a new approach for next generation tools.
The other way around: CodeMirror might listen to ##mw.hook()## and gets nudged to re-start for entire textarea content.
* [[https://www.mediawiki.org/wiki/Topic:Twt8s67hwtmaa7jo | Extension talk:CodeMirror #How to send a command to CodeMirror from JS?]] is complaining.
* Apparently current implementaton is listening to keystroke or mouse evets only.