Options
All
  • Public
  • Public/Protected
  • All
Menu

type-signals

Type Signals

Small and fast Signal library for Typescript.

Heavily inspired by mini-signals;

Install

npm install type-signals

Documentation

  • TODO

Example Usage

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