Normalize events
Install with component(1):
$ component install stephenmathieson/normalize
Normalize the event provided to fn
. Will fallback to window.event
if no event is provided to fn
.
Normalize the given event
. Will fallback to window.event
.
normalize
will provide you access to the following properties and methods of an Event
:
- target
- which
- preventDefault()
- stopPropagation()
var ev = require('event');
var normalize = require('normalize');
var foo = document.getElementById('foo');
ev.bind(foo, 'click', normalize(function (e) {
// ...
}));
ev.bind(foo, 'mouseover', function (e) {
e = normalize(e);
// ...
});
MIT