Skip to content

Branch

Name Mandatory Description Default Type
⬅️ Input Any input type is accepted. The input value will pass through unchanged. Any
Output ➡️ Outputs the input value, passed through unchanged. Any
Wires No The Wires to schedule and run on this branch. none Wire[Wire]None
FailureBehavior No The policy to take when some of the Wires running on this branch fail. BranchFailure::Everything BranchFailure
CaptureAll No If all of the existing variables should be copied onto the branch created, regardless if they are used or not. false Bool
Mesh No The Behavior to branch from. If none provided, it will branch from the Behavior that the current Wire is on. Mesh 0x000002019A2CC3B0 NoneMesh

Creates a branch from the specified Behavior and schedules all the Wires specified. Every time this shard is called, it will progress the state of all the Wires specified asynchronously and continue execution of the current Wire. This shard is like a mass Step, where it Steps all the Wires specified.

Details

All child wires scheduled inherits and uses the context variables of the parent wire. Any changes to said variables will also be reflected on the parent wire and subsequent child wires scheduled.

Child wires are scheduled and executes inline. The parent wire will progress the state of all child wires sequentially, however, if there is any pauses or breaks in the child wires' execution, the shard will progress the state of the next child wire or relinquish control back to the parent wire. This means that any pauses on any child wire will not pause the parent wire.

Child wires are scheduled on a child mesh of the mesh the parent wire is on.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
@wire(c1 {
  msg1 | Log
})

@wire(c2 {
  msg2 | Log
})

@wire(branch {
  "Hello" = msg1
  "World" = msg2
  Branch([c1 c2])
})

Do(branch)

[info] [c1] Hello
[info] [c2] World