Skip to main content
The Deno 2 Release Candidate is here
Learn more

promisub

The publish/subscription utility by Promise in Deno.

Usage

const p = new Promisub<number>();

// Publish events
p.publish(event1, event2, ...);

// Wait an event
await p.once();

// Listen events infinite
for await (const event of p) {
  // Handle event here
  // :
  // :

  // Stop to listen
  p.close();
}