ProtoFlux:ASync While: Difference between revisions

From Resonite Wiki
added info, no longer stub
AsyncCall not SyncResumption
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
|Outputs=
|Outputs=
[
[
{"Name": "LoopStart", "Type":"SyncResumption"},
{"Name": "LoopStart", "Type":"AsyncCall"},
{"Name": "LoopIteration", "Type":"SyncResumption"},
{"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|SyncResumption]]) and LoopIteration ([[Impulses#ASync|SyncResumption]]) 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]].
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|SyncResumption]]) or plugging a value that will never be true into Condition ([[Type:Bool|bool]]) may result in a crash or infinite execution!|danger}}
{{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 ==
== Inputs ==


=== * ([[Impulses#ASync|AsyncCall]]) ===
=== * ([[Impulses#ASync|IAsyncOperation]]) ===


Call this to start execution of the loop.
Call this to start execution of the loop.
Line 27: Line 27:
=== Condition ([[Type:Bool|bool]]) ===
=== Condition ([[Type:Bool|bool]]) ===


The execution will check this after every finished LoopIteration ([[Impulses#ASync|SyncResumption]]) and will fire the next LoopIteration ([[Impulses#ASync|SyncResumption]]) if the provided Condition is true.
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 ==
== Outputs ==


=== LoopStart ([[Impulses#ASync|SyncResumption]]) ===
=== LoopStart ([[Impulses#ASync|AsyncCall]]) ===


Fires once * ([[Impulses#ASync|AsyncCall]]) is called before even checking if this node can execute.
Fires once * ([[Impulses#ASync|IAsyncOperation]]) is called before even checking if this node can execute.


=== LoopIteration ([[Impulses#ASync|SyncResumption]]) ===
=== LoopIteration ([[Impulses#ASync|AsyncCall]]) ===


Fires once the previous LoopIteration ([[Impulses#ASync|SyncResumption]]) has fired and finished or LoopStart ([[Impulses#ASync|SyncResumption]]) has fired and finished.  
Fires once the previous LoopIteration ([[Impulses#ASync|AsyncCall]]) has fired and finished or LoopStart ([[Impulses#ASync|AsyncCall]]) has fired and finished.  


=== LoopEnd ([[Impulses|Continuation]]) ===
=== LoopEnd ([[Impulses|Continuation]]) ===


Fires after a LoopIteration ([[Impulses#ASync|SyncResumption]]) has fired and Condition ([[Type:Bool|bool]]) is false.
Fires after a LoopIteration ([[Impulses#ASync|AsyncCall]]) has fired and Condition ([[Type:Bool|bool]]) is false.


== Example ==
== Example ==

Latest revision as of 22:48, 16 February 2024

Async While
*
LoopStart
Condition
LoopIteration
LoopEnd
Async

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.

Caution should be used when using this node. giving it no nodes to fire on LoopIteration (AsyncCall) or plugging a value that will never be false into Condition (bool) may result in a crash or infinite execution!

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