One thing that caused my grief when working with subscribed signals (HR, pace) in main.js or in onLoad is that on the simulator signals are always available. On the watch subscribed signals seem to transition from ‘undefined’ -> ‘NaN’ -> a valid number.
I ended up needing to protect any use of these signals by using isFinite(), like this.
// Get the index of the the active zone for a 5 zone HR gauge
// v current value
// zones an array of 4-values defining the 5 zones
function getActiveZone(v, zones) {
if (!isFinite(v)) return 0;
for (var i = 1; i < zones.length; i++) {
if (v < zones[i]) return i - 1;
}
return zones.length - 1;
}
Inserting systemEvent() was quite effective in pinpointing the point of failure once I understood how to do it. But I do not really get any error message, just something like this. [MR] messages are inserted by me, so I can see something happened after “G4a”, but not what the actual error was.
#3251371 26.05.2026 17:44:39 : EVT UI_FRAMEWORK : JS [MR] G1
#3251372 26.05.2026 17:44:39 : EVT UI_FRAMEWORK : JS [MR] G2
#3251373 26.05.2026 17:44:39 : EVT UI_FRAMEWORK : JS [MR] G3
#3251374 26.05.2026 17:44:39 : EVT UI_FRAMEWORK : JS [MR] G4a1-not-supported
#3251375 26.05.2026 17:44:39 : WRN UI_FRAMEWORK : JS
I am more of a Swift or C# person used to verbose error messages and traceback. But maybe I have been spoiled.