attach-dom-events

1.0.0 • Public • Published

attach-dom-events

unstable

Utility to attach multiple dom events to an element. Uses dom-events.

var attach = require('attach-dom-events')
 
attach(element, {
    mousemove: function(ev) {
        //..
    },
    keydown: function(ev) {
        //..
    }
})

Usage

NPM

attach(element[, events])

attach.on(element[, events])

Attaches the dictionary of events to element, using the keys as event names for addEventListener.

The main exported method is the same as on.

attach.off(element[, events])

Detaches all the given events.

attach.once(element[, events])

Attaches all the given events using once instead of on.

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i attach-dom-events

Weekly Downloads

40

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mattdesl