When is boot.js code called #7741
-
Hey! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It might be worth reading my response to your other post first as they're kind of related: https://github.com/orgs/espruino/discussions/7740 TLDR: boot scripts might not be called for every app load, but if you put something like a boot.js scripts are called when the Bangle reloads the JS instance. For apps that don't support 'fast load' (most apps) when the app exits (or when you long-press to exit) Bangle.js tears the whole JS instance down and restarts, loads boot.js and then the app (eg your clock). However for apps that are written in a certain way (supporting 'Fast Load' - https://www.espruino.com/Bangle.js+Fast+Load) and we can be reasonably sure that they're not going to 'leak' memory and lead to a bad experience, they provide a Generally we make the clock and launcher 'fast load' capable so you can flip between them nice and quick |
Beta Was this translation helpful? Give feedback.
It might be worth reading my response to your other post first as they're kind of related: https://github.com/orgs/espruino/discussions/7740
TLDR: boot scripts might not be called for every app load, but if you put something like a
setInterval
in a boot script, it will always be active (if the JS instance is reset then boot.js will be called right after).boot.js scripts are called when the Bangle reloads the JS instance. For apps that don't support 'fast load' (most apps) when the app exits (or when you long-press to exit) Bangle.js tears the whole JS instance down and restarts, loads boot.js and then the app (eg your clock).
However for apps that are written in a certain way (supporting…