UNPKG

@polygonjs/polygonjs

Version:

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

30 lines (29 loc) 760 B
"use strict"; export class PolySpecializedChildrenController { constructor() { this._map = /* @__PURE__ */ new Map(); } registerHook(hookName, hook) { this._map.set(hookName, hook); this._updateCache(); } _updateCache() { this._hooks = []; const hooks = this._hooks; this._map.forEach((hook) => { hooks.push(hook); }); } runHooks(displayNode, coreGroup, newObjects, params) { let newObjectsAreDifferent = false; if (this._hooks) { for (let hook of this._hooks) { const _newObjectsAreDifferent = hook(displayNode, coreGroup, newObjects, params); if (_newObjectsAreDifferent) { newObjectsAreDifferent = true; } } } return newObjectsAreDifferent; } }