Class inheritance
Classes external to Atomico
import { c, html } from "atomico";
function component() {
return html`<host shadowDom> ...my content </host>`;
}
class VanillaElement extends HTMLElement {
constructor() {
super();
console.log("create");
}
connectedCallback() {
console.log("mount");
}
disconnectedCallback() {
console.log("mount");
}
attributeChangedCallback() {
console.log("my-attr update");
}
static get observedAttributes() {
return ["my-attr"];
}
// ⚠️ not native but valid within Atomico.
// this is just an example the ideal is to
// have a shared reference of the CSSStyleSheet
static get styles(){
const sheet= new CSSStyleSheet();
sheet.replace('a { color: blue; }');
return sheet;
}
}
const Component = c( component, VanillaElement );Classes internal to Atomico
Inheritance outside of Atomico
Last updated
Was this helpful?
