Skip to content

Commit 3c8de89

Browse files
committed
better doc
1 parent 24a9b94 commit 3c8de89

3 files changed

Lines changed: 42 additions & 17 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
2+
connection.project.dir=
3+
eclipse.preferences.version=1

lib/module.android.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ function startMonitoringForRegion(region: BeaconRegion): Promise<any> {
158158
* @returns {Promise<any>} promise resolves to void or error
159159
*/
160160
function startRangingBeaconsInRegion(regionId: string, beaconsUUID?: string): Promise<any> {
161-
return new Promise((resolve, reject) => {
162-
beaconsAndroid.startRanging(regionId, beaconsUUID, resolve, reject);
163-
});
161+
return new Promise(
162+
(resolve, reject) => {
163+
beaconsAndroid.startRanging(regionId, beaconsUUID, resolve, reject);
164+
}
165+
);
164166
}
165167

166168
/**
@@ -170,16 +172,18 @@ function startRangingBeaconsInRegion(regionId: string, beaconsUUID?: string): Pr
170172
* @returns {Promise<any>} promise resolves to void or error
171173
*/
172174
function stopMonitoringForRegion(region: BeaconRegion): Promise<any> {
173-
return new Promise((resolve, reject) => {
174-
beaconsAndroid.stopMonitoring(
175-
region.identifier,
176-
region.uuid,
177-
region.minor ? region.minor : -1,
178-
region.major ? region.major : -1,
179-
resolve,
180-
reject
181-
);
182-
});
175+
return new Promise(
176+
(resolve, reject) => {
177+
beaconsAndroid.stopMonitoring(
178+
region.identifier,
179+
region.uuid,
180+
region.minor ? region.minor : -1,
181+
region.major ? region.major : -1,
182+
resolve,
183+
reject
184+
);
185+
}
186+
);
183187
}
184188

185189
/**

lib/new.module.ios.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,35 @@ function startMonitoringForRegion(region: BeaconRegion): void {
6565
*
6666
* @param {BeaconRegion} region region to scan (identifier + uuid -> major and minor are optional)
6767
*/
68-
function startRangingBeaconsInRegion(region: BeaconRegion): void {
69-
return RNiBeacons.startRangingBeaconsInRegion(region);
68+
function startRangingBeaconsInRegion(region: BeaconRegion): Promise<any> {
69+
return new Promise(
70+
(resolve, reject) => {
71+
try {
72+
RNiBeacons.startRangingBeaconsInRegion(region);
73+
resolve();
74+
} catch (error) {
75+
reject(error);
76+
}
77+
}
78+
);
7079
}
7180

7281
/**
7382
* stop monitoring for a region
7483
*
7584
* @param {BeaconRegion} region region (identifier + uuid -> major and minor are optional)
7685
*/
77-
function stopMonitoringForRegion(region: BeaconRegion): void {
78-
return RNiBeacons.stopMonitoringForRegion(region);
86+
function stopMonitoringForRegion(region: BeaconRegion): Promise<any> {
87+
return new Promise(
88+
(resolve, reject) => {
89+
try {
90+
RNiBeacons.stopMonitoringForRegion(region);
91+
resolve();
92+
} catch (error) {
93+
reject(error);
94+
}
95+
}
96+
);
7997
}
8098

8199
/**

0 commit comments

Comments
 (0)