-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
40 lines (35 loc) · 880 Bytes
/
index.ts
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
//@ts-ignore
import { NativeModules } from "react-native";
//@ts-ignore
const { RnSensorStep } = NativeModules;
export enum SensorType {
COUNTER = "COUNTER",
DETECTOR = "DETECTOR",
}
interface IRNSensorStep {
start: (delay: number, sensorType: SensorType) => void;
stop: () => void;
checkSensorPermission: () => Promise<boolean>;
requestSensorPermission: () => void;
}
const RNSensorStep: IRNSensorStep = {
start: (delay, sensorType): void => {
RnSensorStep.start(delay, sensorType);
},
stop: () => {
RnSensorStep.stop();
},
checkSensorPermission: () => {
return new Promise((resolve, reject) => {
try {
resolve(RnSensorStep.checkSensorPermission());
} catch (e) {
reject(e);
}
});
},
requestSensorPermission: () => {
RnSensorStep.requestSensorPermission();
},
};
export default RNSensorStep;