blish-hud / Blish-HUD

A Guild Wars 2 overlay with extreme extensibility through compiled modules.
https://blishhud.com
MIT License
322 stars 59 forks source link

Initial implementation of the event bus service #976

Open Tharylia opened 1 month ago

Tharylia commented 1 month ago

This PR aims to provide an event bus communication channel for cross module interaction within blish core. Each event identifier is based on the modules namespace and an event id (string) which can be freely choosen.

The content is typed as an object to allow module devs to accept any kind of data.

The actions which are executed for subscribers are designed with async tasks in mind. Upon dispatching an event, all subscribers are executed in parallel.

If the registering module is dispatching an event but there are no subscribers no exception is thrown. If the calling module is trying to dispatch an event to the registering module an exception is thrown if there are no subscribers. (Registering module is disabled or the event simple does not exist)

Discussion Reference

All new features must be discussed prior to code review. This is to ensure that the implementation aligns with other design considerations. Please link to the Discord discussion:

https://discord.com/channels/531175899588984842/599270434642460753/1265237773019779142

Is this a breaking change?

Breaking changes require additional review prior to merging. If you answer yes, please explain what breaking changes have been made.

No