constructor(type: object)
View sourceCreates a typed asset pool for values identified by type.
The supplied constructor is retained as the asset family’s type identity for handles and resource access.
Class
ExtendsAssets
Typed resource alias for the shared Assets pool of Image
assets. It inherits Assets behavior, including Assets#add
and Assets#get, for storing and resolving image handles.
RenderCorePlugin registers the pool for access through
world.getResource and ImageAssets. AssetServer can
supply a handle while an image loads; resolve it with Assets#get
after the asset becomes available.
import { AssetServer } from '@wimaengine/asset'
import { Image, ImageAssets } from '@wimaengine/render-core'
function requestImage(world, path) {
const server = world.getResource(AssetServer)
const handle = server.load(Image, path)
const images = world.getResource(ImageAssets)
const image = images.get(handle)
// Loading is processed asynchronously, so `image` may be undefined yet.
return image?.dimensions
}constructor(type: object)Creates a typed asset pool for values identified by type.
The supplied constructor is retained as the asset family’s type identity for handles and resource access.