@ihealth/ihealthlibrary-react-native
Version:
React Native Model for iHealth Library
38 lines (29 loc) • 716 B
Markdown
```js
import {
NT13BModule,
NT13BProfileModule
} from '@ihealth/ihealthlibrary-react-native';
```
```js
// add
notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => {
console.log(event);
});
// remove
notifyListener.remove();
```
```js
NT13BModule.measure(mac);
// response
notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => {
if (event.action === NT13BProfileModule.ACTION_MEASUREMENT_RESULT) {
console.log(event[NT13BProfileModule.RESULT]);
console.log(event[NT13BProfileModule.UNIT_FLAG]);
}
});
```