ImageCache <T>
Index
Constructors
constructor
Parameters
name: string
browserCache: BrowserCache
options: Options<T>
How to turn bytes into a payload, and how to free it
Returns ImageCache<T>
Properties
_decode
Type declaration
Parameters
blob: Blob
Returns T | Promise<T>
_dispose
Type declaration
Parameters
data: T
Returns void
browserCache
Persistent byte store, or null if the Cache API isn't usable.
cache
lastPurge
name
Methods
_imageStateDidChange
Private function called when an image state changes.
Parameters
image: CachedImage<T>
The image whose state changed
Returns void
_refreshCharactersForImage
Given an image, refresh all characters that would be impacted by its load
Parameters
img: CachedImage<T>
Returns void
clear
Clear all cached images
Returns void
delete
Remove a cached image by its URL.
Parameters
url: string
The URL of the image to delete
Returns void
forEach
Iterate over all cached images
Parameters
callback: (img, key, map) => void
The callback to call on each (URL, image) pair
Returns void
get
Get a cached image from the cache.
Parameters
url: string
The URL of the image to lookup
Returns CachedImage<T>
The cached image
has
Check whether an image is in the cache
Parameters
url: string
The URL of the image to lookup
Returns boolean
purge
Purge all images errored or not used in the last half-purge delay
Parameters
force: boolean = false
Returns void
stats
Output some stats about the cache
Returns void
totalImages
Get the count of cached images.
Returns number
The class responsible for loading and caching images