Wrapper around (add/remove)EventListener
that supports adding multiple events at the same time, and chaining calls. Similar to jQuery's syntax.
Currently, a setup with either browserify or webpack is required for use.
$ npm install --save chainable-event-listener
var EventChain = require('chainable-event-listener');
var $exampleElement = new EventChain(exampleElement);
$exampleElement.on('mouseup mousedown keyup', fakeFunction)
.on('mousedown', anotherFunction);
Note: I chose to prefix the $exampleElement
with a $
symbol for this example to indicate that this is not a reference to exampleElement
, but instead it's eventChain. Of course you can name it like you want, I just named it like this because this module tries to emulate the jQuery API anyway.