Commit 6e97ba39 authored by Greg Wilson's avatar Greg Wilson Committed by GitHub

added saveHeight method docs

parent e45fa393
...@@ -16,6 +16,7 @@ A React Native bridge module for interacting with [Apple HealthKit] data. ...@@ -16,6 +16,7 @@ A React Native bridge module for interacting with [Apple HealthKit] data.
* [getLatestWeight](#getlatestweight) * [getLatestWeight](#getlatestweight)
* [saveWeight](#saveweight) * [saveWeight](#saveweight)
* [getLatestHeight](#getlatestheight) * [getLatestHeight](#getlatestheight)
* [saveHeight](#saveheight)
* [getLatestBmi](#getlatestbmi) * [getLatestBmi](#getlatestbmi)
* [getLatestBodyFatPercentage](#getlatestbodyfatpercentage) * [getLatestBodyFatPercentage](#getlatestbodyfatpercentage)
* [getLatestLeanBodyMass](#getlatestleanbodymass) * [getLatestLeanBodyMass](#getlatestleanbodymass)
...@@ -190,7 +191,7 @@ AppleHealthKit.getLatestWeight(null, (err: string, weight: number) => { ...@@ -190,7 +191,7 @@ AppleHealthKit.getLatestWeight(null, (err: string, weight: number) => {
return; return;
} }
weight = _.round(weight,1); weight = _.round(weight,1);
// do something with the weight... // use weight ...
}); });
``` ```
...@@ -199,12 +200,12 @@ ___ ...@@ -199,12 +200,12 @@ ___
#### **`saveWeight`** #### **`saveWeight`**
save a numeric weight value to HealthKit save a numeric weight value to HealthKit
`saveWeight` accepts an object containing a numeric weight value with the key *weight*: `saveWeight` accepts an options object containing a numeric weight value:
```javascript ```javascript
let saveOptions = {weight: 200} let options = {value: 200}
``` ```
```javascript ```javascript
AppleHealthKit.saveWeight(saveOptions, (err, res) => { AppleHealthKit.saveWeight(options, (err, res) => {
if(err){ if(err){
console.log("error saving weight to healthkit: ", err); console.log("error saving weight to healthkit: ", err);
return; return;
...@@ -223,9 +224,28 @@ AppleHealthKit.getLatestHeight(null, (err: string, height: number) => { ...@@ -223,9 +224,28 @@ AppleHealthKit.getLatestHeight(null, (err: string, height: number) => {
console.log("error getting latest height: ", err); console.log("error getting latest height: ", err);
return; return;
} }
// do something with the height value... // use height ...
}); });
``` ```
___
#### **`saveHeight`**
save a numeric height value to HealthKit
`saveHeight` accepts an options object containing a numeric height value:
```javascript
let options = {value: 200}
```
```javascript
AppleHealthKit.saveHeight(options, (err, res) => {
if(this._handleHealthKitError(err, 'saveHeight')){
return;
}
// height successfully saved
});
```
___ ___
#### **`getLatestBmi`** #### **`getLatestBmi`**
......
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