I would be happy to see an OnSelectionChanged event in the DOPus scripting api. It would be triggered for a tab when the selection is changed in it, e.g. by the user or a script. The passed parameter could contain the selection before and after the event (or the delta) and the trigger (script, user, reload).
I would already have an existing script that could benefit from this event, as well as a possible one to enable a selection history (e.g. if the selection was accidentally deleted or otherwise changed).