Memory cached and persistent key-value local storage for Fitbit OS.
Install the module:
npm i fitbit-preferences
Import the script:
import { preferences } from "fitbit-preferences";
Store your values:
preferences.keep_screen_on = true;
preferences.user_name = "John Doe";
preferences.birth_year = 1988;
Read your values:
let keepScreenOn = preferences.keep_screen_on;
let userName = preferences.user_name;
let birthYear = preferences.birth_year;
The script loads the data automatically on start, and saves it on close.
And that's all!