Note: You are on the beta version of our docs. This is a work in progress and may contain broken links and pages.
Classes
ImageCache
ImageCache
Represents a class that stores handles image download requests and caches the already downloaded images.
Summary
Constructors
Properties
Methods
Constructors
constructor
new ImageCache(): ImageCache
inherited from constructor
Returns ImageCache
Properties
maxRequests
The maximum number of simultaneous download requests. Defaults to 5.
placeholder
placeholder: ImageSource
The image to be used to notify for a pending download request - e.g. loading indicator.
downloadErrorEvent
Static
String value used when hooking to download error event.
downloadedEvent
Static
String value used when hooking to downloaded event.
Methods
clear
Removes all the previously cached images.
Returns void
disableDownload
Temporary disables download requests.
Returns void
enableDownload
Enables previously suspended download requests.
Returns void
enqueue
enqueue(request: DownloadRequest): any
Adds a new download request at the end of the download queue. This will be the last download to start.
Parameter | Default | Description |
request |
|
Returns any
get
Gets the image for the specified key. May be undefined if the key is not present in the cache.
Parameter | Default | Description |
key |
| string |
Returns any
on
on(eventNames: string, callback: (args: EventData) => void, thisArg?: any): void
A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
Parameter | Default | Description |
eventNames |
| string String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change"). |
callback |
| (args: EventData) => void Callback function which will be executed when event is raised. |
thisArg |
| any An optional parameter which will be used as `this` context for callback execution. |
Returns void
on(event: "downloaded", callback: (args: DownloadedData) => void, thisArg?: any): void
Raised when the image has been downloaded.
Parameter | Default | Description |
event |
| "downloaded" |
callback |
| (args: DownloadedData) => void |
thisArg |
| any |
Returns void
on(event: "downloadError", callback: (args: DownloadError) => void, thisArg?: any): void
Raised if the image download errors.
Parameter | Default | Description |
event |
| "downloadError" |
callback |
| (args: DownloadError) => void |
thisArg |
| any |
Returns void
push
push(request: DownloadRequest): any
Adds a new download request at the top of the download queue. This will be the next immediate download to start.
Parameter | Default | Description |
request |
|
Returns any
remove
Removes the cache for the specified key.
Parameter | Default | Description |
key |
| string |
Returns void
set
Sets the image for the specified key.
Parameter | Default | Description |
key |
| string |
image |
| any |
Returns void
- Previous
- ImageAsset
- Next
- ImageSource