@repeaterjs/pubsub
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

@repeater/pubusb

This package is experimental!

A generic pubsub class, implemented with repeaters

For more information, visit repeater.js.org.

interface PubSub<T> {
  publish(topic: string, value: T): Promise<void> | void;
  unpublish(topic: string, reason?: any): Promise<void> | void;
  subscribe(topic: string, buffer?: RepeaterBuffer<T>): AsyncIterableIterator<T>;
  close(reason?: any): Promise<void> | void;
}

class InMemoryPubSub<T> implements PubSub<T> {
  publish(topic: string, value: T): void;
  unpublish(topic: string, reason?: any): void;
  subscribe(topic: string, buffer?: RepeaterBuffer<T>): Repeater<T>;
  close(reason?: any): void;
}

/@repeaterjs/pubsub/

    Package Sidebar

    Install

    npm i @repeaterjs/pubsub

    Weekly Downloads

    601

    Version

    0.3.4

    License

    MIT

    Unpacked Size

    17.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • brainkim