attach-dom-events
v1.0.0
Published
util to attach multiple dom events to an element
Downloads
189
Maintainers
Readme
attach-dom-events
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
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.