UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

15 lines (14 loc) 484 B
"use strict"; import { ref } from "../../core/reactivity/CoreReactivity"; const refChildrenCountByUuid = /* @__PURE__ */ new WeakMap(); export function getObjectChildrenCountRef(object) { let _ref = refChildrenCountByUuid.get(object); if (!_ref) { _ref = ref(object.children.length); refChildrenCountByUuid.set(object, _ref); } return _ref; } export function updateObjectChildrenCountRef(object) { getObjectChildrenCountRef(object).value = object.children.length; }