CustomElement
MMO.elements · 1 symbol · generated 30 Sep 2026
CustomElement
CustomElement.js:36CustomElement mixin WARNING: It is a class mixin. Meaning you extend it with a parameter
- Namespace
MMO.elements- Extends
ClassElement
Index
| promise readonly accessor | Resolved once the element is connected AND the document has loaded. | |
| defaultAttributes static readonly accessor | ||
| ViewDefault static readonly accessor | The data the element's view starts with. | |
| observedAttributes static readonly accessor | Get a list of observable attributes | |
| constructor() | ||
| remove() | Override: tear the view down (watches and listeners included) before leaving the dom. | |
| replaceWith(args) | Override: tear the view down before being replaced. | |
| domReady(success) | Run a callback once the document has loaded. | |
| ready(success) | Run a callback once the element is fully ready. | |
| isInitialized() | ||
| onMutation(callback, watchSubtree) | Register a callback to be called when children are added/deleted from this element NOTE: to stop the watch, call disconnect on the returned MutationObserver | |
| render($view) | static get AttributesSchema() { return MMO.schemas.exists(this.name)? | |
| init() | Render the element, then hoist the <style> tags it produced up to the document head (or to the enclosing shadow root), once per element type rather than once per instance. | |
| errorMessage(title, message) | Replace the element's content with a loud red error banner. | |
| attributeChangedCallback(name, oldVal, newVal) | ||
| connectedCallback() | Custom element lifecycle: render once, then push the declared attributes into the view. |
Properties4
promise
readonlyaccessorCustomElement.js:92Resolved once the element is connected AND the document has loaded.
- Type
Promise<this>
defaultAttributes
staticreadonlyaccessorCustomElement.js:142ViewDefault
staticreadonlyaccessorCustomElement.js:150The data the element's view starts with. Override it to seed the model.
- Type
Object
observedAttributes
staticreadonlyaccessorCustomElement.js:158Get a list of observable attributes
- Type
Array<string>
Methods12
constructor()
CustomElement.js:37remove()
CustomElement.js:74Override: tear the view down (watches and listeners included) before leaving the dom.
replaceWith(args)
CustomElement.js:83Override: tear the view down before being replaced.
| ...args | ...(Node | string) |
domReady(success)
CustomElement.js:101Run a callback once the document has loaded.
| success | Function | |
| returns | Promise |
ready(success)
CustomElement.js:110Run a callback once the element is fully ready. MMO.elements.CustomElement#promise
| success | Function | |
| returns | Promise |
isInitialized()
CustomElement.js:117| returns | boolean | true once connectedCallback has run |
onMutation(callback, watchSubtree)
CustomElement.js:129Register a callback to be called when children are added/deleted from this element NOTE: to stop the watch, call disconnect on the returned MutationObserver
| callback | ||
| watchSubtree = false | ||
| returns |
render($view)
CustomElement.js:185static get AttributesSchema() { return MMO.schemas.exists(this.name)? MMO.schemas.getById(this.name) : this.BuildAttributesSchema(); }
| $view |
init()
CustomElement.js:191Render the element, then hoist the <style> tags it produced up to the document head (or to the enclosing shadow root), once per element type rather than once per instance.
errorMessage(title, message)
CustomElement.js:220Replace the element's content with a loud red error banner.
| title | string | |
| message | string |
attributeChangedCallback(name, oldVal, newVal)
CustomElement.js:228| name | ||
| oldVal | ||
| newVal |
connectedCallback()
CustomElement.js:245Custom element lifecycle: render once, then push the declared attributes into the view. Runs only on the FIRST connection, so moving the element around is cheap.