defineEffectGate
Builds an EffectGate from a check and a commit. check peeks and refuses by throwing, and
commit applies the side effect, running only once the whole gate set passes so a later refusal never
commits. In an or, seedcord rolls back the commit a refusing gate queued. This is how Cooldown peeks
in check and charges the slot in commit.
See also:defineGate, the @Gated decorator from your transport package, Cooldown
defineEffectGate<Name, Ctx>(
name: Name,
check: (ctx: Ctx) => Promisable<void>,
commit: (ctx: Ctx) => Promisable<void>
): EffectGate<Ctx, Name>Name
The gate's literal name, used to name a mismatch error.
NameThe gate's literal name, used to name a mismatch error.
Ctx
The context both check and commit read, inferred from the ctx annotation.
CtxThe context both check and commit read, inferred from the ctx annotation.
name
name: NameThe gate's name, used in mismatch errors.
check
check: (ctx: Ctx) => Promisable<void>Peeks and refuses by throwing, without applying the side effect.
commit
commit: (ctx: Ctx) => Promisable<void>Applies the side effect, running only after the whole gate set passes.