-
• #2
It actually might be the fact that my task is running a little longer then i first thought. So i'm guessing until my main task is finished or is halted by a promises. A set timeout won't trigger?
-
• #3
Also sorry for my bad terminology. I don't actually know how to describe of Environment. Its like a light multitasking environment. Javascript as a "operating system".
-
• #4
Your terminology sounds fine to me! A promise chain itself is not blocking but in JavaScript the execution of function code is (unless you declare it 'async' which Espruino doesn't support - but all that does it effectively split the function into a bunch of smaller sync functions joined with promises).
So Espruino can only run one bit of code at a time (it's not pre-emptive), but by splitting the code up and calling the next bit of code from a promise/callback it can then interleave those smaller bits of code and make it seem multi-tasking.
So in your case as you noted I think maybe one part of the promise is just taking a long time to finish?
I have a simple blinking light in the background on my NRF52840 board. It blinks every like 1 second. But when i'm waiting for one of my promises to resolve the blinking light seems to be not working.
So do promises block the thread?