Skip to content

Add support for custom events - #271

Open
freya022 wants to merge 17 commits into
3.Xfrom
feature/custom-events
Open

Add support for custom events#271
freya022 wants to merge 17 commits into
3.Xfrom
feature/custom-events

Conversation

@freya022

@freya022 freya022 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

It is now allowed to make listeners of any type. (except Any/Object)

Users who wish to listen to custom events must have at least one CustomEventRequirementsProvider,
which must return the requirements for the provided event type.

Note: This API is considered experimental and requires an opt-in.

freya022 added 17 commits August 4, 2026 17:16
Previously, all event types were known, and so we were able to group the handlers by what they were listening to

However this required scanning the events present at runtime, which not only took some time, but also prevents using custom events

The new approach instead computes the handlers eligible for a certain event when it is first fired, this performs slightly better and works for any event type and simplifies the logic for adding/removing listeners
Would have caused a circular dependency when a user attempts to inject an EventDispatcher in an event listener class
It's an assumption in some places
Makes it easier to test and declutters the registry service
As the registry may reference classes that uses the dispatcher
@freya022 freya022 added type: feature type: incubating New feature that does not have a stable API yet labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature type: incubating New feature that does not have a stable API yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant