API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classAssetType
A first-class asset type: everything the loader needs to know about one kind of asset, in one value. An instance is an immutable descriptor. Installing it on an Application - by listing it in an Extension's `assets` - is what makes it loadable there, and only there: two applications in one process may have entirely different type sets. Installation calls createFactory once, so the mutable half of a type lives per application and is destroyed with it. The type owns four separable decisions, and no more: - what it is called (id) and which file suffixes name it (extensions); - when two requests are the same runtime resource (resourceIdentity); - when two requests acquire the same source data (sourceIdentity); - how a representation is read (codec), laid out in a cache (layout) and turned into a resource (createFactory); - what a catalog hands out before the payload arrives (leaf). Acquisition, caching and residency are the loader's, and the type is deliberately given no way to reach them.
import { AssetType } from '@codexo/exojs'A first-class asset type: everything the loader needs to know about one kind of asset, in one value.
An instance is an immutable descriptor. Installing it on an Application - by listing it in an Extension's `assets` - is what makes it loadable there, and only there: two applications in one process may have entirely different type sets. Installation calls createFactory once, so the mutable half of a type lives per application and is destroyed with it.
The type owns four separable decisions, and no more:
- what it is called (id) and which file suffixes name it (extensions); - when two requests are the same runtime resource (resourceIdentity); - when two requests acquire the same source data (sourceIdentity); - how a representation is read (codec), laid out in a cache (layout) and turned into a resource (createFactory); - what a catalog hands out before the payload arrives (leaf).
Acquisition, caching and residency are the loader's, and the type is deliberately given no way to reach them.
new(): AssetType<Source, Resource, Options, Stored>asset(source: string, options?: Options): AssetA typed, loadable asset reference. Holds config only - no loaded resource.<Resource>createFactory(): AssetFactoryBuilds one kind of runtime resource from normalized source data. A factory owns construction and teardown, and nothing else: it does not fetch, does not decide…<Source, Resource, Options>resourceIdentity?(request: AssetRequestOne request for an asset of a given type, as an identity hook sees it.<Options>): stringsourceIdentity?(request: AssetRequestOne request for an asset of a given type, as an identity hook sees it.<Options>): stringunacquiredSource?(request: AssetRequestOne request for an asset of a given type, as an identity hook sees it.<Options>, url: string, network: NetworkSnapshot): undefined | { source: Source }extensions: readonly string[]id: string