1.0.3 • Published 4 months ago
@shanlabs/signaller v1.0.3
@shanlabs/signaller
A simple event signaling library for JavaScript/TypeScript.
Installation
npm install @shanlabs/signaller
Usage
import { createSignaller } from "@shanlabs/signaller";
const signaller = createSignaller();
signaller.on("event", (data) => {
console.log("Received:", data);
});
signaller.emit("event", { hello: "world" });
API
createSignaller()
Creates a new signaller instance.
Instance Methods
on(event, handler)
— Listen for an event.emit(event, payload)
— Emit an event with optional payload.off(event, handler)
— Remove a specific handler.
License
ISC