@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
20 lines (15 loc) • 582 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 SceneLifeCycleController {
constructor(private scene: PolyScene) {}
private _lifecycleOnAfterCreatedAllowed: boolean = true;
onAfterCreatedCallbackAllowed(): boolean {
return this.scene.loadingController.loaded() && this._lifecycleOnAfterCreatedAllowed;
}
onAfterCreatedPrevent(callback: () => void) {
this._lifecycleOnAfterCreatedAllowed = false;
callback();
this._lifecycleOnAfterCreatedAllowed = true;
}
}