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

Method getChildByType

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

* returns the list of children with the specified class type * @param {object} classType - Class type * @returns {Renderable[]} Array of children

(classType, objList = [])

Source from the content-addressed store, hash-verified

640 * @returns {Renderable[]} Array of children
641 */
642 getChildByType(classType, objList = []) {
643 this.forEach((child) => {
644 if (child instanceof classType) {
645 objList.push(child);
646 }
647 if (child instanceof Container) {
648 child.getChildByType(classType, objList);
649 }
650 });
651
652 return objList;
653 }
654
655 /**
656 * returns the list of children with the specified name<br>

Callers 1

container.spec.jsFile · 0.80

Calls 2

forEachMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected