Skip to content

Instantly share code, notes, and snippets.

Created April 10, 2019 18:57
What would you like to do?
import htm from ''; // for parity of renderer plus access to element properties
const handler = (e) => console.log("You've got an event at the parent level:",e);
const eventToComponent = htm`<MyComponent onSomething=${handler} />`;
const eventToCustomElement = htm`<my-component onSomething=${handler} />`;
// OR, you can use capturing to manage this sort of thing via central data store
document.body.addEventListener('something', e => {
console.log("You've got an event at the central data store level:",e);
// Do central data store stuff...
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment