MCPcopy Create free account
hub / github.com/melonjs/melonJS / isAttachedToRoot

Method isAttachedToRoot

packages/melonjs/src/renderable/container.js:722–735  ·  view source on GitHub ↗

* Checks if this container is root or if it's attached to the root container. * @returns {boolean} true if this container is root or if it's attached to the root container

()

Source from the content-addressed store, hash-verified

720 * @returns {boolean} true if this container is root or if it's attached to the root container
721 */
722 isAttachedToRoot() {
723 if (this.root === true) {
724 return true;
725 } else {
726 let ancestor = this.ancestor;
727 while (ancestor) {
728 if (ancestor.root === true) {
729 return true;
730 }
731 ancestor = ancestor.ancestor;
732 }
733 return false;
734 }
735 }
736
737 /**
738 * Returns the instance of the root container (i.e. the current application World container).

Callers 4

addChildMethod · 0.95
addChildAtMethod · 0.95
container.spec.jsFile · 0.80
renderable.spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected