Effect-based publish/subscribe event bus: per-instance PubSub channels (typed + wildcard) bridged to the process-wide GlobalBus, with Promise/callback helpers for non-Effect callers.
Classes
Members
(static, constant) InstanceDisposed
Event published right before an instance's bus is shut down, carrying the instance directory.
(static, constant) defaultLayer
Default layer used when no explicit Bus layer is provided.
(static, constant) layer
Effect layer that builds the Bus service: per-instance state plus publish/subscribe operations.
Methods
(static) createID() → {string}
Generate a new ascending event id.
A fresh "evt" identifier.
- Type:
- string
(static) publish(def, properties, options) → {Promise.<void>}
Publish an event from non-Effect code (resolves once published).
| Name | Type | Description |
|---|---|---|
def | Object | Event definition identifying the channel/type. |
properties | Object | Event payload properties. |
options | Object | Optional overrides; |
Resolves when the event has been published.
- Type:
- Promise.<void>
(static) subscribe(def, callback) → {function}
Subscribe to a single event type with a callback from non-Effect code.
| Name | Type | Description |
|---|---|---|
def | Object | Event definition identifying the typed channel. |
callback | function | Invoked with each payload of |
Unsubscribe function.
- Type:
- function
(static) subscribeAll(callback) → {function}
Subscribe to all event types with a callback from non-Effect code.
| Name | Type | Description |
|---|---|---|
callback | function | Invoked with each published payload. |
Unsubscribe function.
- Type:
- function