Skip to content

Lightweight Strong Typed Event Signaling for TypeScript

License

Notifications You must be signed in to change notification settings

endel/strong-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Lightweight Strong Typed Event Signaling for TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published