BaseElement class extends the built-in HTMLElement class with a bit of convenience
functionality, first and foremost in the addition of the
BaseElement knows how to hook into a scene and/or a game powered by three-elements, but otherwise doesn't
interact with Three.js in any way. You can use it as a base class for logic-only custom components that
need access to the game's ticker or renderer.
A list of properties that can also be set through attributes on the element's tag. Attribute names are expected to be kebab-cased versions of the original property names (eg. "renderTick" can be set through the attribute "render-tick".)
Returns the instance of ThreeGame that this element is nested under.
Returns this element's tag name, formatted as an actual HTML tag (eg. "
Returns the instance of ThreeScene that this element is nested under.
Helper method that will make sure all attributes set on the element are passed
attributeChangedCallback. We mostly need this because of how we're
Takes a function, then walks up the node tree and returns the first node where the function returns true.
This callback is invoked when the element is deemed properly initialized. Most importantly, this happens in a microtask that is very likely executed after all the other elements in the document have finished running their connectedCallbacks.
While disconnectedCallback is invoked whenever the element is removed from the DOM or just moved to a new parent, removedCallback will only be invoked when the element is actually being removed from the DOM entirely.
We're overloading setAttribute so it also invokes attributeChangedCallback. We do this because we can't realistically make use of observedAttributes (since we don't know at the time element classes are defined what properties their wrapped objects are exposing.)
Generated using TypeDoc