crossvent
Cross-platform browser event handling
Last updated 9 years ago by bevacqua .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install crossvent 
SYNC missed versions from official npm registry.

crossvent

Cross-platform browser event handling

The event handler API used by dominus.

Install

Using Bower

bower install -S crossvent

Using npm

npm install -S crossvent

API

The API exposes a few methods that let you deal with event handling in a consistent manner across browsers.

crossvent.add(el, type, fn, capturing?)

Adds an event listener fn of type type to DOM element el.

crossvent.add(document.body, 'click', function (e) {
  console.log('clicked document body');
});

crossvent.remove(el, type, fn, capturing?)

Removes an event listener fn of type type from DOM element el.

crossvent.add(document.body, 'click', clicked);
crossvent.remove(document.body, 'click', clicked);

function clicked (e) {
  console.log('clicked document body');
}

crossvent.fabricate(el, type, model?)

Creates a synthetic custom event of type type and dispatches it on el. You can provide a custom model which will be accessible as e.detail.

crossvent.add(document.body, 'sugar', sugary);
crossvent.fabricate(document.body, 'sugar', { onTop: true });

function sugary (e) {
  console.log('synthetic sugar' + e.detail.onTop ? ' on top' : '');
}

License

MIT

Current Tags

  • 1.5.5                                ...           latest (9 years ago)

14 Versions

  • 1.5.5                                ...           9 years ago
  • 1.5.4                                ...           11 years ago
  • 1.5.3                                ...           11 years ago
  • 1.5.2                                ...           11 years ago
  • 1.5.1                                ...           11 years ago
  • 1.5.0                                ...           11 years ago
  • 1.4.0                                ...           11 years ago
  • 1.3.2                                ...           11 years ago
  • 1.3.1                                ...           11 years ago
  • 1.3.0                                ...           11 years ago
  • 1.2.0                                ...           11 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (15)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |