StaticCACHE_The duration in milliseconds for which a texture will remain cached
StaticloaderA global reference to the singleton texture loader
StaticapproximateA 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.
Optionaloptions: { exclude?: Set<string> } = {}Optionalexclude?: 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
Optionaloptions: {Additional options which modify loading
Optionalclean?: 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.
OptionaldisplayProgress?: booleanDisplay loading progress bar
Optionalescape?: booleanWhether to escape the values of format
OptionalexpireCache?: booleanExpire other cached textures?
Optionalformat?: stringA mapping of formatting strings passed to Localization#format
Optionallocalize?: booleanWhether to localize the message content before displaying it
OptionalmaxConcurrent?: numberThe maximum number of textures that can be loaded concurrently.
Optionalmessage?: 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
StaticfetchUse the Fetch API to retrieve a resource and return a Blob instance for it.
Optionaloptions: { bustCache?: boolean } = {}Options to configure the loading behaviour.
OptionalbustCache?: booleanAppend a cache-busting query parameter to the request.
A Blob containing the loaded data
StaticgetReturn a URL with a cache-busting query parameter appended.
The source URL being attempted
The new URL, or false on a failure.
StaticgetUse 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.
Optionalresolution: number = 1Resolution of the texture data output.
The texture data if the texture is valid, else undefined.
StatichasCheck if a source has a text file extension.
The source.
If the source has a text extension or not.
StaticloadLoad all the textures which are required for a particular Scene.
The Scene to load
Optionaloptions: { additionalSources?: string[]; expireCache?: boolean; maxConcurrent?: number } = {}Additional options that configure texture loading
OptionaladditionalSources?: string[]Additional sources to load during canvas initialize
OptionalexpireCache?: booleanDestroy other expired textures
OptionalmaxConcurrent?: numberThe maximum number of textures that can be loaded concurrently
StaticpinPin a source URL so it cannot be evicted.
The source URL to pin
StaticunpinUnpin a source URL that was previously pinned.
The source URL to unpin
A Loader class which helps with loading video and image textures.