Commit 758054a2 authored by Greg Wilson's avatar Greg Wilson Committed by GitHub

Update README.md

parent 75b48c7a
...@@ -142,15 +142,32 @@ ___ ...@@ -142,15 +142,32 @@ ___
**`getCurrentWeight`** : get the most recent weight value **`getCurrentWeight`** : get the most recent weight value
```javascript ```javascript
AppleHealthKit.getCurrentWeight(null, (err, weight) => { AppleHealthKit.getCurrentWeight(null, (err: string, weight: number) => {
if(err){ if(err){
console.log("error getting current weight: ", err); console.log("error getting current weight: ", err);
return; return;
} }
weight = _.round(weight,1); weight = _.round(weight,1);
// ... // do something with the weight...
}); });
``` ```
___
**`saveWeight`** : save a numeric weight value to HealthKit
`saveWeight` accepts an object containing a numeric weight value with the key *weight*:
```javascript
let saveOptions = {weight: 200}
```
```javascript
AppleHealthKit.saveWeight(saveOptions, (err, res) => {
if(err){
console.log("error saving weight to healthkit: ", err);
return;
}
// weight successfully saved
});
```
[Apple HealthKit]: https://developer.apple.com/healthkit/ [Apple HealthKit]: https://developer.apple.com/healthkit/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment