1.0.0 • Published 10 years ago

attach-dom-events v1.0.0

Weekly downloads
69
License
MIT
Repository
github
Last release
10 years ago

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.