@agilearchitects/broadcast
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Agile Architects / Broadcast

Simple broadcast service. Subscribe/Unsubscribe and emit

Example

import { BroadcastService } from "@agilearchitects/broadcast";

// Create service
const broadcastService = new BroadcastService();

// Create subscription
const subscription = broadcastService.subscribe<string>("bar", (payload?: string) => {
  // Do something awesome
});

// Emit "hello World!" to callback
broadcastService.emit("bar", "Hello World!");

// Unsubscribe
subscription.unsubscribe();

// Callback will not execute
broadcastService.emit("bar", "Hello World!");

Readme

Keywords

none

Package Sidebar

Install

npm i @agilearchitects/broadcast

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

5.07 kB

Total Files

11

Last publish

Collaborators

  • hannesdahlberg