custom-event-universal
v1.0.1
Published
Cross-browser `CustomEvent` constructor. Forked from webmodules/custom-event and modified to not error when browser globals aren't available.
Downloads
7
Maintainers
Readme
custom-event
Cross-browser CustomEvent
constructor
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
Installation
$ npm install custom-event
Example
var CustomEvent = require('custom-event');
// add an appropriate event listener
target.addEventListener('cat', function(e) { process(e.detail) });
// create and dispatch the event
var event = new CustomEvent('cat', {
detail: {
hazcheeseburger: true
}
});
target.dispatchEvent(event);