* Mirrors the fallback chain logic from preloadImage in image.js: * try each source sequentially, stop at the first that succeeds.
( name, sources, fileServer, supportedFormats, imgCache, )
| 110 | * try each source sequentially, stop at the first that succeeds. |
| 111 | */ |
| 112 | function loadWithFallback( |
| 113 | name, |
| 114 | sources, |
| 115 | fileServer, |
| 116 | supportedFormats, |
| 117 | imgCache, |
| 118 | ) { |
| 119 | let chain = Promise.reject(); |
| 120 | const triedSources = []; |
| 121 | for (const src of sources) { |
| 122 | chain = chain.catch(() => { |
| 123 | triedSources.push(src); |
| 124 | return tryLoadSource(src, name, fileServer, supportedFormats, imgCache); |
| 125 | }); |
| 126 | } |
| 127 | return chain.then(() => { |
| 128 | return triedSources; |
| 129 | }); |
| 130 | } |
| 131 | |
| 132 | // ── synthetic compressed texture builders ─────────────────────────────────── |
| 133 |
no test coverage detected