esl
esl copied to clipboard
[🚀esl-event-listener]: add a `group` property to event descriptor type
As a consumer of ESL EventListener, I want to have the capability to unsubscribe and resubscribe from a list of subscriptions.
While our API offers a robust and efficient means to filter subscriptions — allowing subscription, unsubscription, and resubscription by descriptor filter — we've overlooked a common use case: users often have a set of related functionalities with associated listeners. Consequently, there's a frequent need to consistently resubscribe to these listeners, even if the grouping itself lacks any technical correlation.
To address this, proposing to introduce a group
property (even without additional behaviour) that allows users to effectively manage event listeners within groups.
@listen ({ event: 'event1' , group: 'group' } )
_onEvent1 () {}
@listen ({ event: 'event2' , group: 'group' } )
_onEvent2 () {}
// to unsubscribe we can use:
this.$$off({group: 'group'});