I noticed that executing a JS function that does not return within ~1 or 2 seconds causes the interpreter to interrupt it, logging "Execution Interrupted" to the console window (when using the IDE)
Yes, that's expected. It's because you're uploading to 'RAM' with the IDE, so it executes the code as it goes - a bit more info is at https://www.espruino.com/Saving.
The issue is if you had much code in your file after the code that takes a while to run, it could really mess up your upload.
There are some easy fixes:
Run your crunch function with setTimeout(crunch,1000) - so it runs 1 sec after the upload completes
Switch to saving your app to a file in Bangle.js storage. That way the program text all gets uploaded in one go, and it's then executed afterwards
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, that's expected. It's because you're uploading to 'RAM' with the IDE, so it executes the code as it goes - a bit more info is at https://www.espruino.com/Saving.
The issue is if you had much code in your file after the code that takes a while to run, it could really mess up your upload.
There are some easy fixes:
crunch
function withsetTimeout(crunch,1000)
- so it runs 1 sec after the upload completes