Skip to content

Commit cdd34ed

Browse files
committed
fix(core): adjust NgtRendererLike to also have an optional dispose
1 parent 55ce4e7 commit cdd34ed

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

libs/core/src/lib/roots.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export function injectCanvasRootInitializer(injector?: Injector) {
4848
try {
4949
const state = root.snapshot;
5050
state.events.disconnect?.();
51+
5152
state.gl?.renderLists?.dispose?.();
53+
state.gl?.dispose?.();
5254
state.gl?.forceContextLoss?.();
5355
if (state.gl?.xr) state.xr.disconnect();
5456
dispose(state.scene);

libs/core/src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export type NgtCameraParameters = Partial<
3939
> & { manual?: boolean };
4040
export interface NgtRendererLike {
4141
render: (scene: THREE.Scene, camera: THREE.Camera) => any;
42+
dispose?: () => void;
4243
}
4344
export type NgtCanvasElement = HTMLCanvasElement | OffscreenCanvas;
4445
export type NgtGlobalRenderCallback = (timeStamp: number) => void;

0 commit comments

Comments
 (0)