There's an example of this in https://github.com/espruino/BangleApps/blob/9b4d2e140b8876428fb6fff4c3a5d1b060ec0dd3/apps/widviz/widget.js
... maybe this functionality should actually be turned into a library?
@Gordon started
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.
There's an example of this in https://github.com/espruino/BangleApps/blob/9b4d2e140b8876428fb6fff4c3a5d1b060ec0dd3/apps/widviz/widget.js
... maybe this functionality should actually be turned into a library?