import Notebook from "../notebook";
class Module extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
}
async connectedCallback() {
const src = this.getAttribute("src");
const root = this.shadowRoot || this;
if (!src) {
root.innerHTML = `
No src attribute
`;
return;
}
const ar = this.getAttribute("aspectratio");
root.innerHTML = ar
? ``
: ``;
const module = await import(/* webpackIgnore: true */ src);
const element = root.querySelector(".module");
if (element) module.default(Notebook.installed(), element);
}
}
export default Module;