API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceAssetFactory

@codexo/exojs / assets / stable

Builds 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 what a stored representation looks like, and never sees a cache. Acquisition is the loader's, representation is the AssetSourceCodec's, and caching is a policy neither of them knows about. One instance exists per Loader, created by AssetType.createFactory, so loader-local state - a worker, a compiled module, a parsed lookup shared by every resource of this type - belongs on the instance and is torn down with the loader that owns it.

0
props
3
methods
0
events
Import
import { AssetFactory } from '@codexo/exojs'

Builds 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 what a stored representation looks like, and never sees a cache. Acquisition is the loader's, representation is the AssetSourceCodec's, and caching is a policy neither of them knows about.

One instance exists per Loader, created by AssetType.createFactory, so loader-local state - a worker, a compiled module, a parsed lookup shared by every resource of this type - belongs on the instance and is torn down with the loader that owns it.

Methods3
Builds the runtime resource. Failures here are construction failures, not source failures.
destroy?(): void
Releases what the factory itself owns, once, when its loader is destroyed. Use dispose for a single evicted resource.
dispose?(resource: Resource): void
Releases ONE resource this factory produced, when the loader evicts it at refcount 0. The factory stays alive and keeps serving every other resource it created. Implement it only when a resource owns something the garbage collector cannot reclaim on its own - a media element, a FontFace registered on document.fonts, a GPU buffer, a worker. A decoded AudioBuffer, a parsed object or a compiled WebAssembly.Module needs nothing. Must be synchronous, and must tolerate a resource that was already released.
Source