polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
20 lines (15 loc) • 549 B
text/typescript
import {PolyScene} from '../PolyScene';
// TODO: considerer removing this module
// since now the on create hooks should all be in the editor
export class LifeCycleController {
constructor(private scene: PolyScene) {}
private _lifecycle_on_create_allowed: boolean = true;
onCreateHookAllowed(): boolean {
return this.scene.loadingController.loaded() && this._lifecycle_on_create_allowed;
}
onCreatePrevent(callback: () => void) {
this._lifecycle_on_create_allowed = false;
callback();
this._lifecycle_on_create_allowed = true;
}
}