On this pageInterfaces
Command/Interruptible
/**
* 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
}/**
* 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
}/**
* 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
}/**
* 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`
}/**
* 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`
}/**
* 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", {}>/**
* 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", {}>