bubbly
Effortlessly create CustomEvent instances.
Trigger events on any object that implements the EventTarget interface.
Fits well with Custom Elements in Web Components based apps.
Designed to be used with ECMAScript Function Bind syntax.
Installation
npm install --save bubbly
Usage
dispatch(type, detail)
const target = target::
bubble(type, detail)
Like dispatch
but lets the event bubble up.
documentbody::
on(type, handler)
Alias for addEventListener
.
document::
off(type, handler)
Alias for removeEventListener
.
document::
once(type, handler)
Wait for an event to fire, then stop listening.
const anchor = documentanchor::
Or treat an event like a Promise.
await anchor::
Development
Run tests
npm test
TDD
mocha --watch