MCPcopy Create free account
hub / github.com/epicweb-dev/react-suspense / imgSrc

Function imgSrc

exercises/06.optimization/02.solution.cache/utils.tsx:46–50  ·  view source on GitHub ↗
(src: string)

Source from the content-addressed store, hash-verified

44const imgCache = new Map<string, Promise<string>>()
45
46export function imgSrc(src: string) {
47 const imgPromise = imgCache.get(src) ?? preloadImage(src)
48 imgCache.set(src, imgPromise)
49 return imgPromise
50}
51
52function preloadImage(src: string) {
53 return new Promise<string>(async (resolve, reject) => {

Callers 2

ShipDetailsFunction · 0.90
ImgFunction · 0.90

Calls 1

preloadImageFunction · 0.70

Tested by

no test coverage detected