Created
April 10, 2019 18:57
-
-
Save Westbrook/5286281c0f541359e87f22c849f4bbb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import htm from 'https://unpkg.com/htm?module'; // 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 => { | |
e.stopPropagation(); | |
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