InstanceStore
Since 0.6
Signature
export interface InstanceStore<T> {
/** Build and record this entity's instance, replacing any existing one. */
set(ctx: Keyed, value: T): T
/** This entity's instance, or null. */
get(ctx: Keyed): T | null
/**
* This entity's instance, building it if the behavior somehow ticked before `init` ran. Named `ensure`
* rather than `require` so no bundle of a behavior ever contains the bare word the host's sandbox scan
* looks for.
*/
ensure(ctx: Keyed, make: () => T): T
/** Forget this entity's instance. */
drop(ctx: Keyed): void
/** How many entities this module is live on; a leak check for tests. */
readonly size: number
}
Import: import type { InstanceStore } from "@argus/gameplay"
Members
| Member | Signature | Description |
|---|---|---|
set | set(ctx: Keyed, value: T): T | Build and record this entity's instance, replacing any existing one. |
get | get(ctx: Keyed): T | null | This entity's instance, or null. |
ensure | ensure(ctx: Keyed, make: () => T): T | This entity's instance, building it if the behavior somehow ticked before init ran. Named ensure rather than require so no bundle of a behavior ever contains the bare word the host's sandbox scan looks for. |
drop | drop(ctx: Keyed): void | Forget this entity's instance. |
size | readonly size: number | How many entities this module is live on; a leak check for tests. |