-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (31 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import {DeviceEventEmitter, NativeModules} from 'react-native';
const {BMDPedometer} = NativeModules;
// const EventEmitter = DeviceEventEmitter(BMDPedometer);
export default {
isStepCountingAvailable: callback => {
BMDPedometer.isStepCountingAvailable(callback);
},
isDistanceAvailable: callback => {
BMDPedometer.isDistanceAvailable(callback);
},
isFloorCountingAvailable: callback => {
BMDPedometer.isFloorCountingAvailable(callback);
},
isPaceAvailable: callback => {
BMDPedometer.isPaceAvailable(callback);
},
isCadenceAvailable: callback => {
BMDPedometer.isCadenceAvailable(callback);
},
startPedometerUpdatesFromDate: (date, handler) => {
BMDPedometer.startPedometerUpdatesFromDate(date);
DeviceEventEmitter.addListener('pedometerDataDidUpdate', handler);
},
queryPedometerDataBetweenDates: (startDate, endDate, handler) => {
BMDPedometer.queryPedometerDataBetweenDates(startDate, endDate, handler);
},
stopPedometerUpdates: () => {
BMDPedometer.stopPedometerUpdates();
}
};