chainable-event-listener

1.0.1 • Public • Published

chainable-event-listener

npm version

Wrapper around (add/remove)EventListener that supports adding multiple events at the same time, and chaining calls. Similar to jQuery's syntax.

Usage

Currently, a setup with either browserify or webpack is required for use.

Installation

$ npm install --save chainable-event-listener

Using the helper

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.

Package Sidebar

Install

npm i chainable-event-listener

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • marcohamersma