Small and fast Signal library for Typescript.
Heavily inspired by mini-signals;
npm install type-signals
import { Signal } from 'type-signals';
type OnDoThingSignal = (foo: string, bar: string): void;
const mySignal = new Signal<OnDoThingSignal>();
const binding = mySignal.add(onSignal); // add listener
mySignal.dispatch('foo', 'bar'); // dispatch signal passing custom parameters
binding.detach(); // remove a single listener
function onSignal(foo: string, bar: string)
{
assert(foo === 'foo');
assert(bar === 'bar');
}
Generated using TypeDoc