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