Skip to main content
On this pageInterfaces

Command/Interruptible

Interfaces

DefinitionNoArgs

interfacesource
/**
 * An interruptible Command definition with no declared args; its key is the
 *  Command name. Call as `Definition()` to produce a Command instance; use
 *  `Definition.Interrupt` to build the Command that stops it.
 */
interface DefinitionNoArgs {
  [CommandDefinitionTypeId]: typeof CommandDefinitionTypeId
  Interrupt: InterruptDefinitionNoArgs<Name>
  name: Name
}

DefinitionWithArgs

interfacesource
/**
 * An interruptible Command definition with declared args and a key derived
 *  from them, namespaced by the Command name. Call as `Definition(args)` to
 *  produce a Command instance; use `Definition.Interrupt` to build the
 *  Command that stops every holder of a specific key.
 */
interface DefinitionWithArgs {
  [CommandDefinitionTypeId]: typeof CommandDefinitionTypeId
  Interrupt: InterruptDefinitionWithArgs<Name, KeyArgs>
  name: Name
}

DefinitionWithArgsNameKeyed

interfacesource
/**
 * An interruptible Command definition with declared args but no `toKey`, so
 *  its key is the Command name, exactly like the no-args form. Call as
 *  `Definition(args)` to produce a Command instance; use `Definition.Interrupt`
 *  to build the Command that stops it. Reach for this when a Command takes args
 *  yet at most one invocation is meaningfully in flight, so its invocations need
 *  nothing to distinguish them.
 */
interface DefinitionWithArgsNameKeyed {
  [CommandDefinitionTypeId]: typeof CommandDefinitionTypeId
  Interrupt: InterruptDefinitionNoArgs<Name>
  name: Name
}

InterruptDefinitionNoArgs

interfacesource
/**
 * An Interrupt Command definition derived from an interruptible Command
 *  definition with no declared args. Call as `Definition.Interrupt(toMessage)`
 *  to produce a Command that interrupts every holder of the definition's key.
 */
interface InterruptDefinitionNoArgs {
  [CommandDefinitionTypeId]: typeof CommandDefinitionTypeId
  name: `${Name}.Interrupt`
}

InterruptDefinitionWithArgs

interfacesource
/**
 * An Interrupt Command definition derived from an interruptible Command
 *  definition with declared args. Call as
 *  `Definition.Interrupt(keyArgs, toMessage)` to produce a Command that
 *  interrupts every holder of the key derived from `keyArgs`.
 */
interface InterruptDefinitionWithArgs {
  [CommandDefinitionTypeId]: typeof CommandDefinitionTypeId
  name: `${Name}.Interrupt`
}

Constants

Interrupted

constsource
/**
 * At least one in-flight Command held the interrupt key, and every holder
 *  has been stopped. Their declared result Messages are guaranteed never to
 *  dispatch.
 */
const Interrupted: CallableTaggedStruct<"Interrupted", {}>

NotFound

constsource
/**
 * No Command holds the interrupt key: every target already completed (its
 *  result Message dispatched or will dispatch) or was never dispatched. The
 *  two cases are indistinguishable by design.
 */
const NotFound: CallableTaggedStruct<"NotFound", {}>

Outcome

constsource
/**
 * The result of an Interrupt Command: Interrupted when at least one
 *  holder was stopped, NotFound when nothing held the key.
 *  Interruption itself cannot fail.
 */
const Outcome: Union<readonly [CallableTaggedStruct<"Interrupted", {}>, CallableTaggedStruct<"NotFound", {}>]>

Stay in the update loop.

New releases, patterns, and the occasional deep dive.


Built with Foldkit.

© 2026 Devin Jameson