|
|
|
|
|
by mikebelanger
410 days ago
|
|
You can invoke custom methods and pass in any kind of data into them. As in class SomeElement extends HTMLElement {
constructor() {
super();
}
someMethod(x) {
this.innerHTML = `<h1>${x}</h1>`;
}
}
// ignore registry stuff
const customElement = document.getElementById('custom-element-id');
customElement.someMethod(42);
But you won't learn that from most mainstream custom element tutorials though, for whatever reason. |
|