Hi @sanchez
Yup, your use case make perfect sense. We might add default events in the SelectionExtension
in a future iteration, but you can already achieve the same thing with the following minimal code
export enum SelectionEvent {
Selected,
// Other types that you'd want
}
export class EventedSelectionExtension extends SelectionExtension {
protected applySelection() {
super.applySelection()
this.emit(SelectionEvent.Selected)
/** You can send data as event payload if you wish */
// this.emit(SelectionEvent.Selected, payload)
}
}
Here, we’re defining our own SelectionEvent
types, then we’re extending the default SelectionExtension and making it emit the Selected
event whenever something gets selected. Like you already mentioned all extensions can emit events by default ,so it’s just the matter of calling the emit
function.
For the sake of completeness, here is a sandbox with a complete example containing the above code.
Cheers