SuperEvents
SuperEvents is a lib which extends native Nodejs events API, so you can use native EventEmitter methods and also enhanced methods as :
listen
: create listener for event and returns listenerlistenOnce
: create once listener for event and returns listenerlistenFirst
: create and prepend listener for event and returns listenerlistenFirstOnce
create and prepend once listener for event and returns listener
Listener returned has following methods :
remove
disable
enable
enabled
In event handler, the first argument is the signal event with stopPropagation
method.
Features
- Allows to stop event signal propagation
- Allows to remove, enable, disable a listener
Examples
Simple emit/on
const SuperEvents = const se = const listener = sese
Remove listener
const SuperEvents = const se = const listener = selistenerse
Disable listener
const SuperEvents = const se = const listener = selistenerse
Installation
No runtime dependencies Using typescript + mocha as dev dependencies
Build
npm run build
Test
npm run test