npm i evented-ts
Or
yarn add evented-ts
import create from "evented-ts";
const evented = create();
evented.on("hello", (e) => console.log("hello", e.args));
evented.fire("hello", "world");
Fires an event with optional arguments.
Listens to an event. Returns a function that removes the listener when invoked.
Removes the given listener for the event name. Otherwise removes all listeners for the event name.
Returns whether listeners exist for a given event name.
Returns listeners for a given event name.
See it running in action in this demo.
MIT Copyright (c) Maroun Baydoun.