https://github.com/webmodules/custom-event
Cross-browser `CustomEvent` constructor
https://github.com/webmodules/custom-event
Last synced: 13 days 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 (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-13T17:53:51.000Z (over 8 years ago)
- Last Synced: 2025-03-27T08:04:13.987Z (21 days 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);
```