AssetLoader
Defined in: src/modules/asset-loader/asset-loader.ts:342
A URL-keyed asset cache with in-flight de-duplication: loading the same
handle again returns the cached value or joins the pending request instead of
re-fetching. Supports batch loading, progress reporting, and AbortSignal
cancellation. Because the cache is keyed by URL, one URL may not be reused for
two different asset kinds.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AssetLoader(
options?):AssetLoader
Defined in: src/modules/asset-loader/asset-loader.ts:360
Parameters
Section titled “Parameters”options?
Section titled “options?”AssetLoaderOptions = {}
Returns
Section titled “Returns”AssetLoader
Accessors
Section titled “Accessors”cacheSize
Section titled “cacheSize”Get Signature
Section titled “Get Signature”get cacheSize():
number
Defined in: src/modules/asset-loader/asset-loader.ts:397
Returns
Section titled “Returns”number
inFlightSize
Section titled “inFlightSize”Get Signature
Section titled “Get Signature”get inFlightSize():
number
Defined in: src/modules/asset-loader/asset-loader.ts:474
Returns
Section titled “Returns”number
Methods
Section titled “Methods”clear()
Section titled “clear()”clear():
void
Defined in: src/modules/asset-loader/asset-loader.ts:401
Returns
Section titled “Returns”void
evict()
Section titled “evict()”evict(
input):boolean
Defined in: src/modules/asset-loader/asset-loader.ts:406
Parameters
Section titled “Parameters”string | AssetHandle<unknown>
Returns
Section titled “Returns”boolean
fetchArrayBuffer()
Section titled “fetchArrayBuffer()”fetchArrayBuffer(
url,options?):Promise<ArrayBuffer>
Defined in: src/modules/asset-loader/asset-loader.ts:413
Parameters
Section titled “Parameters”string
options?
Section titled “options?”AssetLoadOptions = {}
Returns
Section titled “Returns”Promise<ArrayBuffer>
fetchJson()
Section titled “fetchJson()”fetchJson<
TValue>(url,options?):Promise<TValue>
Defined in: src/modules/asset-loader/asset-loader.ts:421
Type Parameters
Section titled “Type Parameters”TValue
Section titled “TValue”TValue = unknown
Parameters
Section titled “Parameters”string
options?
Section titled “options?”AssetLoadOptions = {}
Returns
Section titled “Returns”Promise<TValue>
fetchText()
Section titled “fetchText()”fetchText(
url,options?):Promise<string>
Defined in: src/modules/asset-loader/asset-loader.ts:443
Parameters
Section titled “Parameters”string
options?
Section titled “options?”AssetLoadOptions = {}
Returns
Section titled “Returns”Promise<string>
get<
TValue>(handle):TValue|undefined
Defined in: src/modules/asset-loader/asset-loader.ts:451
Type Parameters
Section titled “Type Parameters”TValue
Section titled “TValue”TValue
Parameters
Section titled “Parameters”handle
Section titled “handle”AssetHandle<TValue>
Returns
Section titled “Returns”TValue | undefined
has(
input):boolean
Defined in: src/modules/asset-loader/asset-loader.ts:460
Parameters
Section titled “Parameters”string | AssetHandle<unknown>
Returns
Section titled “Returns”boolean
load()
Section titled “load()”load<
TValue>(handle,options?):Promise<TValue>
Defined in: src/modules/asset-loader/asset-loader.ts:478
Type Parameters
Section titled “Type Parameters”TValue
Section titled “TValue”TValue
Parameters
Section titled “Parameters”handle
Section titled “handle”AssetHandle<TValue>
options?
Section titled “options?”AssetLoadOptions = {}
Returns
Section titled “Returns”Promise<TValue>
loadFontFace()
Section titled “loadFontFace()”loadFontFace(
url,family,options?):Promise<FontFace>
Defined in: src/modules/asset-loader/asset-loader.ts:528
Parameters
Section titled “Parameters”string
family
Section titled “family”string
options?
Section titled “options?”FontFaceAssetOptions & AssetLoadOptions = {}
Returns
Section titled “Returns”Promise<FontFace>
loadImage()
Section titled “loadImage()”loadImage(
url,options?):Promise<HTMLImageElement>
Defined in: src/modules/asset-loader/asset-loader.ts:540
Parameters
Section titled “Parameters”string
options?
Section titled “options?”ImageLoaderOptions = {}
Returns
Section titled “Returns”Promise<HTMLImageElement>
loadMany()
Section titled “loadMany()”loadMany<
THandles>(handles,options?):Promise<{ [Index in string | number | symbol]: AssetValue<THandles[Index]> }>
Defined in: src/modules/asset-loader/asset-loader.ts:548
Type Parameters
Section titled “Type Parameters”THandles
Section titled “THandles”THandles extends readonly AssetHandle<unknown>[]
Parameters
Section titled “Parameters”handles
Section titled “handles”THandles
options?
Section titled “options?”Returns
Section titled “Returns”Promise<{ [Index in string | number | symbol]: AssetValue<THandles[Index]> }>