This package has been deprecated

Author message:

channel has been renamed to repeater, see https://github.com/repeaterjs/repeater/issues/18 for the rationale and https://github.com/repeaterjs/repeater/pull/28 for an upgrade guide. Apologies.

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

0.2.1 • Public • Published

@channel/pubusb

This package is experimental!

A generic pubsub class, implemented with channels

For more information, visit channel.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?: ChannelBuffer<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?: ChannelBuffer<T>): Channel<T>;
  close(reason?: any): void;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @channel/pubsub

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

17 kB

Total Files

9

Last publish

Collaborators

  • brainkim