threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
19 lines • 565 B
JavaScript
import { FileLoader } from 'three';
export class SimpleJSONLoader extends FileLoader {
load(url, onLoad, onProgress, onError) {
return super.load(url, (res) => {
try {
if (typeof res === 'string') {
onLoad?.(JSON.parse(res));
}
else {
throw new Error('Invalid JSON');
}
}
catch (e) {
onError?.(e);
}
}, onProgress, onError);
}
}
//# sourceMappingURL=SimpleJSONLoader.js.map