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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    725
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    725
  • 1.0.3
    193
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i type-signals

Weekly Downloads

487

Version

1.1.0

License

MIT

Unpacked Size

68.7 kB

Total Files

15

Last publish

Collaborators

  • englercj