Have ideas to improve npm?Join in the discussion! »

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

    1.0.7 • Public • Published

    strong-events

    Lightweight Strong Typed Event Signaling for TypeScript / JavaScript.

    What is a Signal?

    TODO

    https://github.com/millermedeiros/js-signals/wiki/Comparison-between-different-Observer-Pattern-implementations

    Installation

    npm install strong-events
    

    Usage

    import { createSignal } from "strong-events";
     
    const onSomeEvent = createSignal<(string) => void>();
     
    // register a callback
    onSomeEvent(function(value) {
      console.log("event emitted with:", value);
    });
     
    // registering a callback to run just once
    onSomeEvent.once(function(value) {
      console.log("event emitted once, with:", value);
    });
     
    // invoke the event
    onSomeEvent.invoke("triggering the event!");

    LICENSE

    MIT.

    Install

    npm i strong-events

    DownloadsWeekly Downloads

    387

    Version

    1.0.7

    License

    MIT

    Unpacked Size

    9.95 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar