OptionalafterOptionalbeforeCalled immediately before each template update
OptionalcomputedAn object or function returning an object which populates the data values
in the templating engine. Such values are accessed using the * notation.
OptionalfinalizeCalled as the final lifecycle method at the end of the unmounting process.
Content has been removed from the DOM and the component is no longer considered mounted when this function runs.
Use this for final cleanup tasks and freeing resources.
OptionalinitialThe initial state for this Component's reactive internal state, if any.
OptionalliveDeclaration of attribute behaviors during updates.
OptionalonIf defined, receives errors caught during the lifecycle methods of this component and it's children. If not defined, this component will instead throw errors as they are found.
If the error cannot be handled, onError() should re-throw it for a higher
up component to evaluate.
To display an error message while removing an erroring component from the
DOM, use this.replaceWith() and a newly constructed placeholder element.
Recovering from errors or displaying a fallback
onError(error) {
// Handle known errors
if (error.message = "Invalid Input") {
this.state.input = "";
return;
}
// Display a fallback banner
const banner = document.createElement("div");
banner.textContent = "An unexpected error done did";
this.replaceWith(banner);
}
OptionalscriptInitialization scripting for this Component
OptionalshadowThe mode for this Component's ShadowRoot.
"open" allows JS access to the children of this component"closed" (default) disallows internal JS accessOptionalstylesA CSSStyleSheet array to adopt to the element's shadow DOM
OptionaltemplateAn HTML Template element for this element to use.
Called immediately after each template update