Skip to content

Execution Flow – loop()

trych edited this page Jan 18, 2018 · 1 revision
                                                    +
User Script + setup() & loop()                      |       Execution Flow
                                                    |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
                                                    |
                                     +------------------->  load global functions (draw(), setup(), loop(), other user functions)           +
                                                    |                                                                                       |
#targetengine "loop"                 +------------------->  load global functions from target engine if any                                 |
// @includepath ~/Documents/;%USERPROFILE%Documents;|                                                                                       |
// @include basiljs/basil.js;        +------------------->  runs basil.js file                                                              |
                                                    |                                                                                       |
                                                    |           clears global space (48-61)                                                 |
                                                    |                                                                                       |
var counter = 0;         <-----------------------------------+  loads global variables (63-69)                                              |
                                                    |                                                                                       |
                                                    |           runs anonymous function (75)                                                |
                                                    |                                                                                       |
                                                    |               loads all basil functions and commands (77-7860)                        |
                                                    |                                                                                       |
                                                    |               runs init() (7862)                                                      |
                                                    |                                                                                       |
                                                    |                   populate global space with basil functions and vars (819)           |
                                                    |                                                                                       |
                                                    |                   runScript() (formerly known as b.go()) (838)                        |
                                                    |                                                                                       |
function setup() {       <---------------+          |                       set up doc via currentDoc() (869)                               |
  // setting things up                   |          |                                                                                       |
}                                        +-------------------------------+  run setup() (872)                                               |
                                                    |                                                                                       |
function loop() {        <-----------------------------------------------+  run loop() (884)     +--------+                                 |
  rect(random(width), random(height), 50, 50);      |                                                     |                                 | Execution Order
}                                                   |                       [catch errors] (889)          |                                 |
                                                    |                                                     |                                 |
                                                    |                   end runScript()                   |                                 |
                                                    |                                                     |                                 |
                                                    |               end init()                            |                                 |
                                                    |                                                     |                                 |
                                                    |           end anonymous function                    |                                 |
                                                    |                                                     |                                 |
                                                    |       end basil.js                                  |                                 |
+---------------------------------------------------+                                                     | loop() keeps repeating          |
                                                    |                                                     |                                 |
stop.jsx                                            |                                                     |                                 |
                                                    |                                                     |                                 |
+---------------------------------------------------+                                                     |                                 |
                                                    |                                                     |                                 |
#targetengine "loop"                 +------------------->  load global functions from target engine      |                                 |
                                                    |                                                     |                                 |
noLoop(true);                        +------------------->  runs noLoop() (973)                           |                                 |
                                                    |                                                     |                                 |
                                                    |           stops loop                                v                                 |
                                                    |                                                                                       |
                                                    |           resets user settings                                                        |
                                                    |                                                                                       |
                                                    |       end noLoop()                                                                    |
if (typeof cleanUp === "function") {                |                                                                                       |
  cleanUp();                         +------------------->  run cleanUp() if any                                                            |
  cleanUp = null;                                   |                                                                                       |
}                                                   +                                                                                       v

Created with ASCIIFlow Infinity. To edit, paste it there and then paste it back here.