Which extension type to use?

I want to write an extension that watches the state for a change of cursor, a selection change and then fires an event unrelated to CodeMirror. What type of extension should I use?

Would an updateListener work?

EditorView.updateListener.of(update => {
  if (update.selectionSet) { }

Yes. My problem is there’s so many way to hook into a state update I’m not sure which one is most suited but that one does looks good. Although I may go with


as it seems to be a shorter route to the selection ranges.