Skip to content

v2.1.0

Compare
Choose a tag to compare
@Alexandre-Herve Alexandre-Herve released this 09 Sep 10:03
· 87 commits to master since this release

Parametric and Lazy slots, noBuffer option

  • 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.