Loop
Description
This object is being used to create a 'Loop' in an App. The Loop triggers again once the object path behind it is done executing. The Loop stops once it is reset. The Loop can be used for example to emulate Rounds or Steps in a Game that have to execute in a specific order.
App Builder Object
Source Code
function execute() {
switch (trigger) {
case TRIGGERS.SYSTEM_OUT_DONE:
if (context.run) {
sendSync([null, new Date()]);
}
break;
case 0:
// Trigger
context.run = true;
sendSync([new Date(), new Date()]);
break;
case 1:
context.run = false;
unblock();
break;
default: break;
}
}
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Trigger | Trigger | This port is being used to start the loop and execute the object’s code. |
2 | Reset Index | Trigger | This port is being used to stop the loop. |
Out Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Initialize Trigger | Trigger | This port is being used to indicate that the loop started and is only executed once. |
2 | Trigger | Trigger | This port is being used to send out trigger messages repeatedly until the object is reset. A new trigger is send out when the execution path of multiple object after the 'Loop' is done executing. |
Properties
Name | Description |
---|---|
Object Name | The name of the object on the canvas. |
Show Code View | The switch to turn on code view for the Code Object. |
Duplicate code into custom Code Object |