diff --git a/docs/blocks.md b/docs/blocks.md index 6b53e456..d0bdba4e 100644 --- a/docs/blocks.md +++ b/docs/blocks.md @@ -2,6 +2,10 @@ ### @description Language constructs for the Block editor. +Blocks snap into each other to define the program that your @boardname@ will run. +Blocks can be event (buttons, shake, ...) or need to be snapped into an event to run. +The [on-start](/blocks/on-start) event runs first. + ```namespaces for (let i = 0;i<5;++i) {} if (true){} diff --git a/docs/blocks/on-start.md b/docs/blocks/on-start.md index 723fbf88..65b736cf 100644 --- a/docs/blocks/on-start.md +++ b/docs/blocks/on-start.md @@ -16,7 +16,13 @@ input.onButtonPressed(Button.A, () => { led.setBrightness(50) ``` - ## What about JavaScript? ``on-start`` only exists in the block editor. In JavaScript, all code executes sequentially from the first line. + +## Hey, my events moved! + +When we transform the blocks into JavaScript, we always place all the event registrations (buttons, shake, ...) +before launching the ``on start`` code. + +If a block from ``on start`` pauses, other registered events will have the opportunity to run as well. \ No newline at end of file