Skip to content

Execution Flow – draw()

trych edited this page Jan 18, 2018 · 1 revision
                                                    +
User Script – setup() & draw()                      |       Execution Flow
                                                    |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
                                                    |
                                     +------------------->  load global functions (draw(), setup(), loop(), other user functions)           +
                                                    |                                                                                       |
// @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)   +---+                |
                                                    |                                                                      |                | Execution Order
function setup() {       <---------------+          |                       set up doc via currentDoc() (869)              |                |
  // setting things up                   |          |                                                                      |                |
}                                        +-------------------------------+  run setup() (872)                              |                |
                                                    |                                                                      |                |
function draw() {        <-----------------------------------------------+  run draw() (876)                               | Undo Part      |
  rect(0, 0, 50, 50);                               |                                                                      |                |
}                                                   |                       [catch errors] (889)                           |                |
                                                    |                                                                      |                |
                                                    |                       reset user settings (917)                      |                |
                                                    |                                                                      |                |
                                                    |                   end runScript()                                +---+                |
                                                    |                                                                                       |
                                                    |               end init()                                                              |
                                                    |                                                                                       |
                                                    |           end anonymous function                                                      |
                                                    |                                                                                       |
                                                    |       end basil.js                                                                    v
                                                    |
                                                    +