type-signals
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Type Signals

Small and fast Signal library for Typescript.

Heavily inspired by mini-signals.

Install

npm install type-signals

Documentation

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');
}

Dependencies (0)

    Dev Dependencies (16)

    Package Sidebar

    Install

    npm i type-signals

    Weekly Downloads

    467

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    68.7 kB

    Total Files

    15

    Last publish

    Collaborators

    • englercj