Function Action

  • Defines a new stateless, valueless node and returns a reference to it. Once a realm instance publishes or subscribes to the node, an instance of that node it will be registered in the realm.

    Parameters

    • init: NodeInit<void> = noop

      an optional function that will be called when the node is registered in a realm. Can be used to create subscriptions and define relationships to other nodes. Any referred nodes will be registered in the realm automatically.

    Returns NodeRef<void>

    Example

    const foo$ = Action((r) => {
    r.sub(foo$, () => console.log('foo action'))
    })
    const r = new Realm()
    r.pub(foo$)

    Remark

    An action is just a signal with void value. It can be used to trigger side effects.

Generated using TypeDoc