preloadImages
Loads and decodes several images with decodeImage, a few at a time, with
mapSettled from helpers4/array.
It never rejects: an image that fails does not stop the others, and its result says why.
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
urls | readonly string[] | The image URLs |
options | PreloadImagesOptions | Concurrency — see PreloadImagesOptions |
Returns
Section titled “Returns”Promise<PromiseSettledResult<HTMLImageElement>[]> — One result per URL, in the same order
Examples
Section titled “Examples”Preload the next screens
Section titled “Preload the next screens”Each URL gets its own result, like Promise.allSettled: a broken image does not stop the others.
Limit concurrent downloads
Section titled “Limit concurrent downloads”concurrency caps how many images load at the same time (6 by default).
Related Types
Section titled “Related Types”PreloadImagesOptions
Section titled “PreloadImagesOptions”Options for preloadImages.
