Socket
Book a DemoInstallSign in
Socket

custom-event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-event-emitter

A browser mixin that makes emitting CustomEvent objects really simple.

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

custom-event-emitter

custom-event-emitter is a browser mixin that makes emitting CustomEvent objects really simple.

install

$ npm install custom-event-emitter

usage

var emitter = require('custom-event-emitter')
var element = document.createElement('p')

// Adds an emit function to the element.
// (the second argument is optional)
emitter.call(element, {
  bubbles: true,
  cancelable: true
})

element.addEventListener('hi', function(e) {
  console.log(e.detail)
  > 'how are you?'
})

element.emit('hi', 'how are you?')

You can run the above example like so:

$ npm run example

license

MIT

Keywords

CustomEvent

FAQs

Package last updated on 13 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts