tahamajs/RR / Docs /visualizer /src /data /spatial_loader.js
tahamajs's picture
download
raw
826 Bytes
/**
* data/spatial_loader.js
* ======================
* Asynchronously loads and validates spatial-data.json.
*/
/**
* Loads spatial scene data from spatial-data.json.
* @param {string} url - Target JSON path
* @returns {Promise<object>} Parsed spatial data object
*/
export async function loadSpatialData(url = 'spatial-data.json') {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error ${response.status} fetching spatial data`);
}
const data = await response.json();
if (!data.models) {
throw new Error("Invalid spatial data: missing 'models' root key");
}
return data;
} catch (err) {
console.error('[spatial_loader] Failed to load spatial data:', err);
throw err;
}
}

Xet Storage Details

Size:
826 Bytes
·
Xet hash:
d4c49aef05925f8695f05624bbc00d9818d2e78268d6259551813a355b26d111

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.