mirror of
https://github.com/flash555588/ai-model-workbench.git
synced 2026-07-22 06:56:38 +00:00
Add load interruption handling, camera zoom controls, refreshed measurement UI, diagnostics/default-route coverage, and aligned docs for the Babylon-default renderer contract.
29 lines
852 B
TypeScript
29 lines
852 B
TypeScript
export interface PreviewLoadOptions {
|
|
signal?: AbortSignal;
|
|
isCurrent?: () => boolean;
|
|
}
|
|
|
|
export class PreviewLoadInterruptedError extends Error {
|
|
constructor(message = "Preview load interrupted") {
|
|
super(message);
|
|
this.name = "PreviewLoadInterruptedError";
|
|
}
|
|
}
|
|
|
|
export function isPreviewLoadInterrupted(options?: PreviewLoadOptions): boolean {
|
|
if (!options) {
|
|
return false;
|
|
}
|
|
return options.signal?.aborted === true || options.isCurrent?.() === false;
|
|
}
|
|
|
|
export function throwIfPreviewLoadInterrupted(options?: PreviewLoadOptions): void {
|
|
if (isPreviewLoadInterrupted(options)) {
|
|
throw new PreviewLoadInterruptedError();
|
|
}
|
|
}
|
|
|
|
export function isPreviewLoadInterruptedError(error: unknown): boolean {
|
|
return error instanceof PreviewLoadInterruptedError
|
|
|| error instanceof Error && error.name === "AbortError";
|
|
}
|