MCPcopy
hub / github.com/sparkjsdev/spark / getAssetFileURL

Function getAssetFileURL

examples/js/get-asset-url.js:1–15  ·  view source on GitHub ↗
(assetFile)

Source from the content-addressed store, hash-verified

1export async function getAssetFileURL(assetFile) {
2 try {
3 const response = await fetch("../assets.json");
4 const assetsDirectory = "/examples/assets/";
5 const assetsInfo = await response.json();
6 let url = assetsInfo[assetFile].url;
7 if (window.sparkLocalAssets) {
8 url = `${assetsDirectory}${assetsInfo[assetFile].directory}/${assetFile}`;
9 }
10 return url;
11 } catch (error) {
12 console.error("Failed to load asset file URL:", error);
13 return null;
14 }
15}

Callers 11

loadGLBFunction · 0.90
initFunction · 0.90
loadDelitGLBFunction · 0.90
morphableSplatMeshFunction · 0.90
initFunction · 0.90
loadSplatsFunction · 0.90
loadTableFunction · 0.90
preloadSplatsFunction · 0.90
runFunction · 0.90
runFunction · 0.90
loadSplatFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected