@munchkinhalfling/chandler
v2.1.3
Published
A utility for creating inline event handlers for Custom Elements v1 with Shadow DOM
Downloads
5
Readme
chandler
a utility for inline event listeners (Shadow DOM)
Example
import eventHandler, {htmlEvents} from '@munchkinhalfling/chandler';
class MyElement extends HTMLElement {
...
render() {
this.shadowRoot.innerHTML = htmlEvents(true)`
...
<button onclick=${this.evt}>Test</button>
...
`;
}
evt() { // 'this' is correctly bound to the custom element instance
...
}
}