(variant: string, style: string)
| 261 | const cache = new Map(); |
| 262 | |
| 263 | function loadIllustrations(variant: string, style: string): Promise<IllustrationItemType[]> { |
| 264 | let key = variant === 'gradient' ? `${variant}:${style}` : variant; |
| 265 | if (cache.has(key)) { |
| 266 | return cache.get(key); |
| 267 | } |
| 268 | |
| 269 | let promise: Promise<IllustrationItemType[]>; |
| 270 | if (variant === 'linear') { |
| 271 | promise = import('./illustrations/linear').then(m => m.default); |
| 272 | } else { |
| 273 | promise = |
| 274 | style === 'generic1' |
| 275 | ? import('./illustrations/generic1').then(m => m.default) |
| 276 | : import('./illustrations/generic2').then(m => m.default); |
| 277 | } |
| 278 | |
| 279 | cache.set(key, promise); |
| 280 | return promise; |
| 281 | } |
no test coverage detected