UNPKG

@polygonjs/polygonjs

Version:

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

13 lines (12 loc) 361 B
import {CoreObjectType, ObjectContent} from '../ObjectContent'; export function withChildrenRemoved<T>(object: ObjectContent<CoreObjectType>, callback: () => T) { const children = object.children; for (const child of children) { object.remove(child); } const result = callback(); for (const child of children) { object.add(child); } return result; }