MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / load

Function load

src/hooks/useAsyncImageCache.ts:225–237  ·  view source on GitHub ↗

* Load an item, using cache if available.

(imageFile: File, cacheKey: string)

Source from the content-addressed store, hash-verified

223 * Load an item, using cache if available.
224 */
225 load(imageFile: File, cacheKey: string): Promise<T | null> {
226 const cached = state.cache.get(cacheKey);
227 if (cached) {
228 return Promise.resolve(cached);
229 }
230
231 let promise = state.loadingPromises.get(cacheKey);
232 if (!promise) {
233 promise = queueLoad(imageFile, cacheKey);
234 state.loadingPromises.set(cacheKey, promise);
235 }
236 return promise;
237 },
238
239 /**
240 * Prioritize loading of a specific image.

Callers

nothing calls this directly

Calls 3

queueLoadFunction · 0.85
getMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected