What problem does it solve?
This Skill provides a type-safe, centralized event bus for cross-module communication, solving the issue of modular A notifying module B and ensuring a streamlined communication process.
Core Features & Use Cases
- Type-Safe Events: Ensures that event payloads match the expected types, preventing runtime errors.
- Event Registration & Unregistration: Allows modules to subscribe to and unsubscribe from specific events.
- Event Broadcasting: Enables modules to broadcast events to all subscribed handlers.
- Once-Only Events: Allows handlers to be executed only once for a particular event.
- Use Case: For a game development scenario, the core-event-bus Skill can be used to handle events like player movement, resource collection, or network status changes across different game modules.
Quick Start
To subscribe to the 'player:moved' event, use the following command: EventBus.on('player:moved', (payload) => { /* handler logic */ }).