10-10-2017 07:03
10-10-2017 07:03
I made a watch face. It's pretty cool. I don't have significant experience with java script;
I added tracking for steps per hour (just visually); it's primitive, does it manually; however, what it revealed to me this morning is that my watch face program terminates when i start my treadmill tracking activity.
I only know this (or think i do) because my hourly count was reset after my treadmill activity (which didn't cross any hourly boundaries); I keep track of the last "HOUR" and when the current hour is different, i reset my hour-start-step variable back to the current step count. to figure out the difference (the current steps THIS hour), i simply subtract the hour-start-step count from the current step count.
So my actual question is.... Is there a way to maintain variables between executions where my program might start & stop? I also tend to use "let" instead of "var" in creating variables / assigning values -- would it make a difference if i used var instead of let?
thanks in advance.
Answered! Go to the Best Answer.
10-10-2017 08:26
10-10-2017 08:26
You can persist information by using the File System API.
https://dev.fitbit.com/guides/file-system/#overview
I hope that helps
10-10-2017 08:26
10-10-2017 08:26
You can persist information by using the File System API.
https://dev.fitbit.com/guides/file-system/#overview
I hope that helps
10-10-2017 08:45
10-10-2017 08:45
Well... that's logical.. is it costly to read & write data? all i really want to do is to keep the current step count at the start of a given hour, so i guess if i read/write once an hour that won't be too terrible.
Thanks!