more info on on-start
This commit is contained in:
parent
51ebc29887
commit
28830aa905
@ -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){}
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user