add-one-dom-event-listener
v1.0.2
Published
绑定事件且避免重复绑定
Downloads
3
Maintainers
Keywords
Readme
依赖于add-dom-event-listener
但是同一个element只绑定一种event一次,不重复绑定
var addEventListener = require('add-one-dom-event-listener');
var handler = addEventListener(document.body, 'click', function(e){
console.log(e.target); // works for ie
console.log(e.nativeEvent); // native dom event
});
handler.remove(); // detach event listener