Skip to content
Interfacecorev0.10.0

EffectGate

A gate that carries a side effect, split so the effect fires only once the gate is the one that let the request through. check peeks and refuses, while commit applies the effect after the whole gate set passes. Cooldown is the catalog gate that returns one. Build one with defineEffectGate.

See also:defineEffectGate

interface EffectGate<
    Ctx extends GateContextBase = GateContextBase,
    Name extends string = string
> extends Gate<Ctx, Name>

Properties

Methods

Name

The gate's literal name, shown when a mismatch error names the gate.

Name extends string = string

name

The gate's name, surfaced in a mismatch error and joined by the combinators.

readonly name: Name

Inherited from:Gate

check()

Reads the context and refuses by throwing a Notice or a Silence, or passes by resolving.

check(ctx: Ctx): Promise<void>

Inherited from:Gate

commit()

Applies the side effect, run only after the whole gate set passes.

commit(ctx: Ctx): Promise<void>