ixfx
    Preparing search index...

    Class DispatchList<V>

    Maintains a list of listeners to receive data

    const d = new DispatchList();

    // Eg: add a listener
    d.add(v => {
    // Handle a value
    });

    // Eg. send a value to all listeners
    d.notify(`some value`);

    Type Parameters

    • V
    Index

    Constructors

    Methods

    • Adds a handler. You get back an id which can be used to remove the handler later.

      Handlers can be added with 'once' flag set to true. This will automatically remove them after the first value is sent to them.

      Parameters

      • handler: Dispatch<V>
      • options: { once?: boolean } = {}

      Returns string

    • Remove a handler by its id.

      Parameters

      • id: string

      Returns boolean

      True if handler was removed, false if not found.