m ProbablePrime moved page ASync While (ProtoFlux) to ProtoFlux:ASync While: Creating protoflux Namespace |
AsyncCall not SyncResumption |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
|Inputs= | |Inputs= | ||
[ | [ | ||
{"Name": "*", "Type": " | {"Name": "*", "Type": "AsyncCall"}, | ||
{"Name": "Condition", "Type": "bool"} | {"Name": "Condition", "Type": "bool"} | ||
] | ] | ||
|Outputs= | |Outputs= | ||
[ | [ | ||
{"Name": "LoopStart", "Type":" | {"Name": "LoopStart", "Type":"AsyncCall"}, | ||
{"Name": "LoopIteration", "Type":" | {"Name": "LoopIteration", "Type":"AsyncCall"}, | ||
{"Name": "LoopEnd", "Type":"Continuation"} | {"Name": "LoopEnd", "Type":"Continuation"} | ||
] | ] | ||
|}} | |}} | ||
ASync While is a ProtoFlux node that will wait for every ASync node fired by LoopStart ([[Impulses#ASync|AsyncCall]]) and LoopIteration ([[Impulses#ASync|AsyncCall]]) to finish their execution before firing the next impulse. This is useful if you want to do a bunch of [[ProtoFlux:GET String|GET String]] requests but you need to wait for the previous one to be done before doing the next, for a specified number of times. This does not behave the same as using a [[ProtoFlux:Start ASync Task|Start ASync Task]] on every [[ProtoFlux:While|While loop]] iteration or even before the [[ProtoFlux:While|While loop]] using a [[ProtoFlux:Start ASync Task|Start ASync Task]]. | |||
{{Template:Note|Caution should be used when using this node. giving it no nodes to fire on LoopIteration ([[Impulses#ASync|AsyncCall]]) or plugging a value that will never be false into Condition ([[Type:Bool|bool]]) may result in a crash or infinite execution!|danger}} | |||
== Inputs == | |||
=== * ([[Impulses#ASync|IAsyncOperation]]) === | |||
Call this to start execution of the loop. | |||
=== Condition ([[Type:Bool|bool]]) === | |||
The execution will check this after every finished LoopIteration ([[Impulses#ASync|AsyncCall]]) and will fire the next LoopIteration ([[Impulses#ASync|AsyncCall]]) if the provided Condition is true. | |||
== Outputs == | |||
=== LoopStart ([[Impulses#ASync|AsyncCall]]) === | |||
Fires once * ([[Impulses#ASync|IAsyncOperation]]) is called before even checking if this node can execute. | |||
=== LoopIteration ([[Impulses#ASync|AsyncCall]]) === | |||
Fires once the previous LoopIteration ([[Impulses#ASync|AsyncCall]]) has fired and finished or LoopStart ([[Impulses#ASync|AsyncCall]]) has fired and finished. | |||
=== LoopEnd ([[Impulses|Continuation]]) === | |||
Fires after a LoopIteration ([[Impulses#ASync|AsyncCall]]) has fired and Condition ([[Type:Bool|bool]]) is false. | |||
== Example == | |||
<gallery widths=480px heights=480px> | |||
File:Protoflux_example_ASync_While.webp| ASync while being used to do website requests repeatedly until X becomes true. | |||
</gallery> | |||
[[Category:ProtoFlux:Flow:Async]] | [[Category:ProtoFlux:Flow:Async]] |
Latest revision as of 22:48, 16 February 2024
ASync While is a ProtoFlux node that will wait for every ASync node fired by LoopStart (AsyncCall) and LoopIteration (AsyncCall) to finish their execution before firing the next impulse. This is useful if you want to do a bunch of GET String requests but you need to wait for the previous one to be done before doing the next, for a specified number of times. This does not behave the same as using a Start ASync Task on every While loop iteration or even before the While loop using a Start ASync Task.
Inputs
* (IAsyncOperation)
Call this to start execution of the loop.
Condition (bool)
The execution will check this after every finished LoopIteration (AsyncCall) and will fire the next LoopIteration (AsyncCall) if the provided Condition is true.
Outputs
LoopStart (AsyncCall)
Fires once * (IAsyncOperation) is called before even checking if this node can execute.
LoopIteration (AsyncCall)
Fires once the previous LoopIteration (AsyncCall) has fired and finished or LoopStart (AsyncCall) has fired and finished.
LoopEnd (Continuation)
Fires after a LoopIteration (AsyncCall) has fired and Condition (bool) is false.
Example
-
ASync while being used to do website requests repeatedly until X becomes true.