![]() |
|
js-signals is similar to an Event Emitter/Dispatcher or a Pub/Sub system.
There's a difference that each event type, there's a controller, which doesn't rely on strings to broadcast/subscribe to events.
The intention of this library is to be a "small brick" that can be used together with other libraries and frameworks, helping people to develop evented applications easily.
Here are some key features of "js-signals":
· Doesn't rely on strings for subscribing/publishing to a event type.
· Trying to dispatch or listen to an event type that doesn't exist throws errors instead of failing silently which helps to identify errors early.
· Code completion friendly.
· Arbitrary number of parameters to event handlers.
· Easy control of the event broadcaster and subscriber, avoiding that the wrong objects reacts to the event.
Convenience methods that usually aren't present on other implementations of the observer pattern like:
· Enable/disable event dispatching per event type.
· Remove all event listeners attached to a specific event type.
· Option to automatically remove listener after first execution.
· Option to bind an execution context to the event handler, avoiding scope issues.
· Remove/detach anonymous listener.
· Favor composition over inheritance.
· Easy to identify which event types the object dispatch.
Requirements:
· JavaScript enabled on client side

Via: js-signals 1.0.0
0 Comment:
Post a Comment