threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
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