Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
DOM event binding and emitting
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
.zuul.yml
README.md
index.js
package.json
test.js

README.md

dom-events

Build Status

DOM event binding and triggering

api

.on(element, name, fn [, useCapture])

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);
});

.off(element, name, fn [, useCapture])

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);

.once(element, name, fn [, useCapture])

Calls fn the first time the event happens and unsubcribes immediately.

.emit(element, name [, opts])

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'):

license

MIT

Something went wrong with that request. Please try again.