10-15-2017 16:16
10-15-2017 16:16
The API docs didn't seem to list out all the components/libraries and their classes/objects that can be imported.
For example, I want to use localStorage or storage.LiveStorage. What component should I import? What object/class in that component can I use?
Also, to use HR sensor, I saw sample code has the following line
import { HeartRateSensor } from "heart-rate";
Without such sample code, just relying on the API docs, can I figure out what is the name of that component and the object/class? It is also unclear whether I need create an instance of that class, or there is an existing singleton object.
Answered! Go to the Best Answer.
10-15-2017 16:22
10-15-2017 16:22
We're working on improving the documentation, specifically in those areas. The update is coming soon, thanks for your feedback.
import { localStorage } from "local-storage" // set the value for a key localStorage.setItem("myKey", "myValue") // get the value for a key console.log(`myKey=${localStorage.getItem("myKey")}`)
import { HeartRateSensor } from "heart-rate";
let heartRateSensor = new HeartRateSensor(); heartRateSensor.start(); heartRateSensor.onreading = () => { console.log(`Current heart rate: ${heartRateSensor.heartRate}`); }
10-15-2017 16:22
10-15-2017 16:22
We're working on improving the documentation, specifically in those areas. The update is coming soon, thanks for your feedback.
import { localStorage } from "local-storage" // set the value for a key localStorage.setItem("myKey", "myValue") // get the value for a key console.log(`myKey=${localStorage.getItem("myKey")}`)
import { HeartRateSensor } from "heart-rate";
let heartRateSensor = new HeartRateSensor(); heartRateSensor.start(); heartRateSensor.onreading = () => { console.log(`Current heart rate: ${heartRateSensor.heartRate}`); }
10-17-2017 18:31
10-17-2017 18:31
I've been trying to figure out the heart rate sensor for the last two hours using the API documentation and I couldn't hammer it out. Most of the things in your sample code just aren't easy to find in the documentation at this moment in time. That updated info can't come fast enough. Thank goodness for this board, I'd still be stuck with a red square with 24hr time in a weird font!
This helps a lot! Thanks for having all the answers!