ts-event-handlers-lite
v0.6.0
Published
TypeScript event listener management - synchronous, asynchronous, event queuing, and more
Downloads
1,242
Readme
TS Event Handlers Lite
Dependencies: none (although AsyncEventListenerList constructor takes a runtime promise library parameter)
Events and event listener management is often integrated into frameworks like jquery, Ember, or Angular but sometimes you want to fire some framework agnostic events. If so, this library is here to help.
It includes event listener lists (synchronous and asynchronous), queue (buffer multiple events before firing them),
and a singular event handler that waits for a single event before informing listeners and informing all subsequently attached listeners immediately (similar to jquery.ready(...)
).
See the test
directory for example usage of the functions in this project.
handlers
AsyncListenerList
- handle a list of asynchronous event listeners and wait for each of them to complete when events are firedListenerList
- a standard synchronous event listener list, when an event is fired, call each of the listeners and pass event failures to an option failure listener, also allows event addition/removal meta listenersEventQueue
- an event listener list which can queue up events and fire them in the order they were generated at a later timeevents.d.ts
- typescript interfaces and typesSingularEventHandler
- an event listener list which waits for a single event and calls all listeners once when the event occurs, any listeners registered after the event occurs are invoked immediately