Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getLoaderDefaultsAsync(): Promise {
if (GLTFTab._LoaderDefaults) {
return Promise.resolve(GLTFTab._LoaderDefaults);
}
const defaults: ILoaderDefaults = {
extensions: {}
};
const engine = new NullEngine();
const scene = new Scene(engine);
const loader = new GLTFFileLoader();
GLTFTab._EnumeratePublic(loader, (key, value) => {
defaults[key] = value;
});
loader.onExtensionLoadedObservable.add(extension => {
const extensionDefaults: any = {};
GLTFTab._EnumeratePublic(extension, (key, value) => {
extensionDefaults[key] = value;
});
defaults.extensions[extension.name] = extensionDefaults;
});
const data = '{ "asset": { "version": "2.0" } }';
return loader.importMeshAsync([], scene, data, "").then(() => {
scene.dispose();
engine.dispose();