Static
CACHE_The duration in milliseconds for which a texture will remain cached
Static
loaderA global reference to the singleton texture loader
Static
approximateA public getter to expose the total approximate memory usage.
The total usage in bytes.
Expire and unload assets from the cache which have not been used for more than CACHE_TTL milliseconds.
Optional
options: { exclude?: Set<string> } = {}Optional
exclude?: Set<string>A set of source URLs to skip from eviction checks.
Retrieve a texture or a sprite sheet from the assets cache
The source URL
The cached texture, a sprite sheet or null
Load an Array of provided source URL paths. Paths which begin with a special character "#" are ignored as texture references.
The source URLs to load
Optional
options: {Additional options which modify loading
Optional
clean?: booleanWhether to clean the provided message string as untrusted user input.
No cleaning is applied if format
is passed and escape
is true or
localize
is true and format
is not passed.
Optional
displayProgress?: booleanDisplay loading progress bar
Optional
escape?: booleanWhether to escape the values of format
Optional
expireCache?: booleanExpire other cached textures?
Optional
format?: stringA mapping of formatting strings passed to Localization#format
Optional
localize?: booleanWhether to localize the message content before displaying it
Optional
maxConcurrent?: numberThe maximum number of textures that can be loaded concurrently.
Optional
message?: stringThe status message to display in the load bar
A Promise which resolves once all textures are loaded
Load a single texture or spritesheet on-demand from a given source URL path
The source texture path to load
The loaded texture object
Add an image or a sprite sheet url to the assets cache. Include an approximate memory size in the stored data.
The source URL.
The asset
Static
fetchUse the Fetch API to retrieve a resource and return a Blob instance for it.
Optional
options: { bustCache?: boolean } = {}Options to configure the loading behaviour.
Optional
bustCache?: booleanAppend a cache-busting query parameter to the request.
A Blob containing the loaded data
Static
getReturn a URL with a cache-busting query parameter appended.
The source URL being attempted
The new URL, or false on a failure.
Static
getUse the texture to create a cached mapping of pixel alpha and cache it. Cache the bounding box of non-transparent pixels for the un-rotated shape.
The provided texture.
Optional
resolution: number = 1Resolution of the texture data output.
The texture data if the texture is valid, else undefined.
Static
hasCheck if a source has a text file extension.
The source.
If the source has a text extension or not.
Static
loadLoad all the textures which are required for a particular Scene.
The Scene to load
Optional
options: { additionalSources?: string[]; expireCache?: boolean; maxConcurrent?: number } = {}Additional options that configure texture loading
Optional
additionalSources?: string[]Additional sources to load during canvas initialize
Optional
expireCache?: booleanDestroy other expired textures
Optional
maxConcurrent?: numberThe maximum number of textures that can be loaded concurrently
Static
pinPin a source URL so it cannot be evicted.
The source URL to pin
Static
unpinUnpin a source URL that was previously pinned.
The source URL to unpin
A Loader class which helps with loading video and image textures.