Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "pubsub"

Index

Classes

Interfaces

Functions

Functions

Const pubsub

  • Topic based stream splitter. Applies topic function to each received value and only forwards it to the child subscriptions of the returned topic.

    remarks

    The actual topic (return value from topic fn) can be of any type, apart from undefined. Complex topics (e.g objects / arrays) are allowed and they're matched with registered topics using {@link @thi.ng/equiv#equiv} by default (but customizable via equiv option). Each topic can have any number of subscribers.

    If a xform transducer is given, it is always applied prior to passing the input to the topic function. I.e. in this case the topic function will receive the transformed inputs.

    PubSub supports dynamic topic subscriptions and unsubscriptions via {@link PubSub.(subscribeTopic:1)} and PubSub.unsubscribeTopic. However, the standard {@link ISubscribable.(subscribe:1)} / ISubscribable.unsubscribe methods are NOT supported (since meaningless) and will throw an error! unsubscribe() can only be called WITHOUT argument to unsubscribe the entire PubSub instance (incl. all topic subscriptions) from the parent stream.

    Type parameters

    • A

    • B

    Parameters

    Returns PubSub<A, B>

Generated using TypeDoc