esl icon indicating copy to clipboard operation
esl copied to clipboard

[🚀esl-event-listener]: add a `group` property to event descriptor type

Open ala-n opened this issue 9 months ago • 0 comments

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'});

ala-n avatar May 02 '24 17:05 ala-n