source: trip-planner-front/node_modules/custom-event/README.md@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 785 bytes
RevLine 
[6a3a178]1custom-event
2============
3### Cross-browser `CustomEvent` constructor
4
5[![Sauce Test Status](https://saucelabs.com/browser-matrix/custom-event.svg)](https://saucelabs.com/u/custom-event)
6
7[![Build Status](https://travis-ci.org/webmodules/custom-event.svg?branch=master)](https://travis-ci.org/webmodules/custom-event)
8
9https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
10
11
12Installation
13------------
14
15``` bash
16$ npm install custom-event
17```
18
19
20Example
21-------
22
23``` js
24var CustomEvent = require('custom-event');
25
26// add an appropriate event listener
27target.addEventListener('cat', function(e) { process(e.detail) });
28
29// create and dispatch the event
30var event = new CustomEvent('cat', {
31 detail: {
32 hazcheeseburger: true
33 }
34});
35target.dispatchEvent(event);
36```
Note: See TracBrowser for help on using the repository browser.