dom-events

dom event binding and triggering

dom-events

DOM event binding and triggering

Bind fn to be called when name is triggered on element.

var eve = require('dom-events');
 
var div = document.createElement('div');
eve.on(div, 'click', function(ev) {
    console.log(ev);
});

Remove fn from being called when name is triggered on element

var eve = require('dom-events');
 
var fn = function(ev) {
    console.log(ev);
};
 
var div = document.createElement('div');
eve.on(div, 'click', fn);
 
// emit some stuff 
 
eve.off(div, 'click', fn);

Force emit name on element.

var eve = require('dom-events');
 
var div = document.createElement('div');
eve.on(div, 'click', function(ev) {
    console.log(ev);
});
 
eve.emit(div, 'click'):

MIT