You're correct that layout.update takes a long time, because it's recalculating the sizes of every element. But there are other ways to update only certain elements of the layout, see the docs here: https://www.espruino.com/Bangle.js+Layout#updating-the-screen.
The first is 'lazy' - it will only update the items that have changed when you call layout.render (not .update, you shouldn't need to call that manually).
The second is, if you give the items you want to change in your layout an id, you can clear it, update it, then render just that item:
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.
You're correct that
layout.update
takes a long time, because it's recalculating the sizes of every element. But there are other ways to update only certain elements of the layout, see the docs here: https://www.espruino.com/Bangle.js+Layout#updating-the-screen.The first is 'lazy' - it will only update the items that have changed when you call
layout.render
(not.update
, you shouldn't need to call that manually).The second is, if you give the items you want to change in your layout an
id
, you can clear it, update it, then render just that item:This doesn't change the size, or change any other items, so it's much faster.
I made this into a function in one of my apps to repeatedly change text values: https://github.com/sir-indy/BangleApps/blob/2508fd38abf4c1f701967824395a311c6c34b114/apps/smpltmr/app.js#L167-L171
Hope that helps!