flywave-mapview.mapviewimagecache.addimage
Home > @flywave/flywave-mapview > MapViewImageCache > addImage
MapViewImageCache.addImage() method
Add an image from an URL and optionally start loading it, storing the resulting TexturizableImage in a ImageItem.
Signature:
addImage(name: string, url: string, startLoading?: boolean): ImageItem | Promise<ImageItem | undefined>;
Parameters
Parameter | Type | Description |
|---|---|---|
name | string | Image name. |
url | string | Image URL. |
startLoading | boolean | (Optional) Optional. Pass |
Returns:
[ImageItem](./flywave-mapview.imageitem.md) \| Promise<[ImageItem](./flywave-mapview.imageitem.md) \| undefined>
The resulting [ImageItem](./flywave-mapview.imageitem.md) or a promise for it if it starts loading.
## Remarks
Names are unique within a [MapView](./flywave-mapview.mapview.md)<!-- -->. URLs are not unique, multiple images with different names can have the same URL. Still, URLs are are loaded only once. If an image with the same name is already registered an error is thrown.