AssetModified

View source

ExtendsAssetEvent

Defines the common base for typed asset-lifecycle events from an Assets pool.

The pool creates one of the concrete subtypes when an asset becomes available, is replaced, or is removed. Use the subtype to identify which lifecycle transition occurred.

Use AssetAdded, AssetModified, and AssetDropped when handling lifecycle events rather than constructing AssetEvent directly.

Examples

import { AssetAdded, Assets } from '@wimaengine/asset'

class Texture {}
const textures = new Assets(Texture)
const handle = textures.add(new Texture())
const [event] = textures.flushEvents()

console.log(event instanceof AssetAdded) // true
console.log(event.type === Texture) // true
console.log(event.id === handle.id()) // true

Constructor


constructor<T>(type: Constructor<T>, handle: AssetId)

View source

Creates the common payload for a typed asset-lifecycle event.

The handle parameter is the packed asset ID stored in AssetEvent#id; concrete lifecycle subtypes inherit this constructor.

Type Parameters

T

Parameters

NameDescriptionDefault
type

Constructor of the affected asset family.

—
handle

Packed ID of the affected asset entry.

—