Skip to content

EffectsHost

Defined in: renderer/src/effects/EffectsHost.ts:24

Per-attachment-site holder for an EffectStack. Every scope (component, layer, scene, screen) carries its own EffectsHost exposed as .fx, so the user-facing API for adding / finding / fading effects is identical regardless of where the effect lives.

The underlying EffectStack is built lazily on first addEffect (or restore) so sites that never use effects pay zero cost.

getContainer is a thunk because some sites (component scope) wire the host at construction time but the underlying display object may itself be created in the same constructor — the thunk removes “is this stable yet?” thinking. makeQueue is optional because some test setups omit a ProcessSystem; calling addEffect then throws a clear error.

new EffectsHost(getContainer, scope, makeQueue): EffectsHost

Defined in: renderer/src/effects/EffectsHost.ts:27

() => Container

EffectScope

(() => ScopedProcessQueue) | undefined

EffectsHost

get size(): number

Defined in: renderer/src/effects/EffectsHost.ts:54

Number of attached effects on this host.

number

addEffect<H>(factory): H

Defined in: renderer/src/effects/EffectsHost.ts:37

Attach a visual effect. Returns a typed handle for fading, removal, intensity, and any per-effect extras the factory exposes.

H extends EffectHandle

EffectFactory<H>

H


destroy(): void

Defined in: renderer/src/effects/EffectsHost.ts:75

Internal

— torn down by the owning site (component/layer/scene/screen) before its container is destroyed, so user-assigned external filters survive the EffectStack teardown.

void


findEffect<H, O>(definition): H | null

Defined in: renderer/src/effects/EffectsHost.ts:47

Recover the handle for the first effect attached here whose underlying definition is definition. Returns null if no match exists. Useful after save/load to re-acquire a handle whose caller-side reference went stale during restoration.

H extends EffectHandle

O

EffectDefinition<H, O>

H | null


restore(snap): void

Defined in: renderer/src/effects/EffectsHost.ts:66

Internal

— used by the renderer’s snapshot contributor.

EffectStackSnapshot

void


serialize(): EffectStackSnapshot | undefined

Defined in: renderer/src/effects/EffectsHost.ts:59

Internal

— used by the renderer’s snapshot contributor.

EffectStackSnapshot | undefined