Event System
Build reactive applications with MoroJS's powerful event system. Decouple components, enable real-time features, and create scalable architectures.
On this page
Events That Just Work
Emit and listen to events with one line.
Decouple components, enable real-time features, and build reactive architectures.
It's This Simple
Emit and listen to events
typescript
Why Events Matter
Without proper event systems, you're tightly coupling components, blocking requests, and making real-time features difficult. With MoroJS, you get all of that automatically.
Traditional event handling requires manual setup and coordination. We handle that automatically.
Without Events
- •Tightly coupled components
- •Blocking request handlers
- •No real-time capabilities
- •Hard to scale and maintain
With MoroJS
- •Decoupled component architecture
- •Asynchronous event processing
- •Built-in real-time support
- •Scalable reactive patterns
It's This Easy
Emit events from anywhere. Listen from anywhere. That's it.
Simple event patterns
typescript
Why It Makes Sense
Decoupled
Components communicate through events. No direct dependencies.
Reactive
Build reactive applications with event-driven architecture.
Scalable
Easy to add new listeners. Easy to scale. Easy to maintain.
How It Works
MoroJS includes a built-in event bus that allows components to communicate asynchronously. You emit events from route handlers, modules, or anywhere in your application, and listeners react to those events. This decouples components and enables reactive, scalable architectures.
Basic Event Usage
Event Emitting and Listening
typescript
Event System Benefits
- • Decoupled component architecture
- • Asynchronous processing capabilities
- • Real-time feature support
- • Module isolation and communication
- • Scalable reactive patterns
Advanced Event Patterns
Functional Event Handling
typescript
Event Processing Pipeline
typescript