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").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