exadel-inc / esl

Lightweight and flexible UI component library based on web components technology for creating basic UX modules
https://esl-ui.com
MIT License
58 stars 9 forks source link

[πŸš€esl-event-listener]: add a `group` property to event descriptor type #2381

Closed ala-n closed 4 months ago

ala-n commented 4 months ago

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 commented 3 months ago

:tada: This issue has been resolved in version 5.0.0-beta.17 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

ala-n commented 3 months ago

:tada: This issue has been resolved in version 4.17.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: