README
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!");