Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webmodules/custom-event
Cross-browser `CustomEvent` constructor
https://github.com/webmodules/custom-event
Last synced: 19 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 (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-13T17:53:51.000Z (about 8 years ago)
- Last Synced: 2024-11-07T13:50:54.774Z (about 1 month ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 99
- Watchers: 6
- Forks: 16
- 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[![Sauce Test Status](https://saucelabs.com/browser-matrix/custom-event.svg)](https://saucelabs.com/u/custom-event)
[![Build Status](https://travis-ci.org/webmodules/custom-event.svg?branch=master)](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);
```