Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
const { el: { components: { fs } } } = this;
const { path, indexPath } = this.data;
let indexPromise = null;
const loader = new THREE.FileLoader();
loader.setPath(path);
const fetchIndex = () => {
info('Fetching index for the first time');
return fetchJson(`${path}${indexPath}`).then(index => ({
indexMap: keyBy(index),
index,
}));
};
this.cleanup = fs.registerFileSystem({
id: 'xhr',
load(options, onLoad, onProgress, onError) {
const { url, responseType } = options;
loader.setResponseType(responseType);
loader._originalLoad(url, onLoad, onProgress, onError);
load(url, onLoad, onProgress, onError) {
verbose('Loading data %s', url);
this._url = url;
const loader = new THREE.FileLoader(this.manager);
loader.setPath(this.path);
loader.setResponseType('blob');
loader.load(url, blob => {
verbose('Loaded data from %s, %d bytes', url, blob.size);
jBinary.load(blob, typeSet).then(binary => {
onLoad(this.parse(binary.readAll()), this._meta);
}).catch(err => {
error('Fatal error', err);
if (onError) {
onError(err);
}
});
}, onProgress, onError);
}
load(url, onLoad, onProgress, onError) {
verbose('Loading data %s', url);
const loader = new THREE.FileLoader(this.manager);
loader.setPath(this.path);
loader.setResponseType('blob');
loader.load(url, blob => {
verbose('Loaded data from %s, %d bytes', url, blob.size);
jBinary.load(blob, typeSet).then(binary => {
onLoad(this.parse(binary.readAll()));
}).catch(err => {
error('Fatal error', err);
if (onError) {
onError(err);
}
});
}, onProgress, onError);
}
handleAED(fileName) {
const loader = new THREE.FileLoader();
loader.setPath(getRootPath());
loader.setResponseType('blob');
loader.load(fileName, blob => {
jBinary.load(blob, actorTypeSet).then(binary => {
const actor = binary.readAll();
this.target.appendChild(
);
}).catch(err => {
warn('Error parsing actor: %o', err);
});
});
},
load(url, onLoad, onProgress, onError) {
verbose('Loading data %s', url);
const loader = new THREE.FileLoader(this.manager);
loader.setPath(this.path);
loader.setResponseType('blob');
loader.load(url, blob => {
verbose('Loaded data from %s, %d bytes', url, blob.size);
jBinary.load(blob, typeSet).then(binary => {
onLoad(this.parse(binary.readAll(), url));
}).catch(err => {
error('Fatal error', err);
if (onError) {
onError(err);
}
});
}, onProgress, onError);
}