📨 Distributed messaging in TypeScript
createEventBus
which allow the local end off the connector to not listen to the events from the ignore list.BREAKING CHANGE FROM CONSUMER POINT OF VIEW Rework library's build:
Thanks @ziir
Fix slot config override issue
Introducing the concept of parametric slot:
A new "param" argument on trigger
and .on
allows us to send data through a slot for a specific parameter with slot(<param>, <data>)
, and reciprocally to listen to a specific parameter with slot.on(<param>, <data>)
.
Lazy callbacks are now called for each parameter separately: connect is called with param as argument the first time someone connects somewhere with .on(<param>, ...)
and same thing for disconnect.
If this first parameter is skipped, then a default parameter is used. This help us when the slot has no need for such a parameter and for retro-compatibility concerns.
Introducing the concept of lazy
slot: slots expose a lazy
method that will allow you to call a "connect" callback when a first client connects to the slot, and a "disconnect" callback when the last client disconnect. Remote or local clients are considered equally. If a client was already connected to the slot at the time when lazy
is called, the "connect" callback is called immediately.
Introducing the noBuffer
config option on a slot: with this option setup, slots won't wait for all remote handlers to be connected before triggering anymore.
Fixing combineEvents
: we come back to previous implementation. The newest one required that the combined event declarations all had the same type, which is not the point. We are also now throwing when encountering duplicate event declarations.
Renaming FAKE_SLOT
-> notConnectedSlot
as there is nothing fake, and I found the name a bit misleading, particularly when this slot now holds the slot config prior to connection.
BREAKING CHANGES
GenericChannel
now has a dedicated constructor which accepts an optional timeout argument that defaults to 5000ms
GenericChannel
's _timeout
is now private, and a timeout getter
is available