https://github.com/webmodules/custom-event
Cross-browser `CustomEvent` constructor
https://github.com/webmodules/custom-event
Last synced: 5 months ago
JSON representation
Cross-browser `CustomEvent` constructor
- Host: GitHub
- URL: https://github.com/webmodules/custom-event
- Owner: webmodules
- License: mit
- Created: 2015-01-07T21:15:52.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-10-13T17:53:51.000Z (over 9 years ago)
- Last Synced: 2025-10-04T01:01:53.482Z (5 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 99
- Watchers: 5
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
- awesome-star-libs - webmodules / custom-event
README
custom-event
============
### Cross-browser `CustomEvent` constructor
[](https://saucelabs.com/u/custom-event)
[](https://travis-ci.org/webmodules/custom-event)
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
Installation
------------
``` bash
$ npm install custom-event
```
Example
-------
``` js
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);
```