Skip to content

ProcessSlot

Defined in: ProcessSlot.ts:42

A reusable, restartable process handle owned by a ProcessComponent.

Starts in completed state (ready to use). Call start() to activate. Use for cooldowns, invincibility windows, flash effects, shakes, etc.

new ProcessSlot(config?): ProcessSlot

Defined in: ProcessSlot.ts:62

ProcessSlotConfig = {}

ProcessSlot

_guardCallback: ((run) => void) | undefined

Defined in: ProcessSlot.ts:60

Internal

Runs slot callbacks the engine invokes outside a tick — cleanup from cancel() and restart() — through the owning component’s error boundary, so a throw is attributed to the slot rather than to whichever game code called cancel(). — set by ProcessComponent.slot()

get completed(): boolean

Defined in: ProcessSlot.ts:71

Whether the slot has completed (starts true).

boolean


get elapsed(): number

Defined in: ProcessSlot.ts:81

Seconds elapsed since start.

number


get ratio(): number

Defined in: ProcessSlot.ts:96

Progress ratio 0..1 (elapsed / duration). 0 if no duration set.

number


get running(): boolean

Defined in: ProcessSlot.ts:76

Whether the slot is actively running (not completed and not paused).

boolean


get tags(): readonly string[]

Defined in: ProcessSlot.ts:90

Tags for filtering/grouping — the running slot’s tags, which start() overrides can replace for one run, and the configured tags once it has completed.

readonly string[]

_tick(dt): unknown

Defined in: ProcessSlot.ts:169

Internal

Advance the slot by dt seconds. Returns whatever config.update returned — boolean | void per its declared type, but nothing stops a caller from passing an async function anyway, so the caller-observed return can also be a thenable. Returning it lets tickProcessGuarded attach a rejection handler, mirroring Process._update. — called by ProcessComponent

number

unknown


cancel(): void

Defined in: ProcessSlot.ts:128

Cancel the slot. Calls cleanup if running.

void


onComplete(fn): this

Defined in: ProcessSlot.ts:152

Set/override the onComplete callback. Chainable. Applies to the current run as well as to later ones.

() => void

this


pause(): void

Defined in: ProcessSlot.ts:139

Pause the slot.

void


restart(overrides?): this

Defined in: ProcessSlot.ts:122

Cancel if running, then start fresh. Always restarts.

Partial<Omit<ProcessSlotConfig, "clock">>

this


resume(): void

Defined in: ProcessSlot.ts:144

Resume the slot.

void


start(overrides?): this

Defined in: ProcessSlot.ts:109

Start the slot. No-op if already running (use restart() to force), which also means overrides passed to a running slot are discarded.

Overrides apply to this run only: the next bare start() uses the config the slot was created with.

Partial<Omit<ProcessSlotConfig, "clock">>

this

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.