MutationObserver attributeChangedCallback
const MyElement = customElement(({ attrSignals }) => {
const [heading, setHeading] = attrSignals['my-heading'];
// setHeading() will also update the `my-heading` attribute in the HTML.
return html`<h2>${heading}</h2>`;
});
MutationObserver observedAttributes MutationObserver attributeChangedCallback
const MyElement = customElement(({ attrSignals }) => {
const [heading, setHeading] = attrSignals['my-heading'];
return html`<h2>${heading}</h2>`;
}, { observedAttributes: ['my-heading'] });
<my-element my-heading="My Element's Title"></my-element>
NOTICE: Since
attrSignals Proxy