forked from RoJoHub/react-native-ping
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (24 loc) · 652 Bytes
/
index.js
File metadata and controls
26 lines (24 loc) · 652 Bytes
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
import { NativeModules } from 'react-native';
const { RNReactNativePing } = NativeModules;
class Ping {
/**
*
* Get RTT (Round-trip delay time)
*
* @static
* @param {string} ipAddress - For example : 8.8.8.8
* @param {Object} option - Some optional operations
* @param {number} option.timeout - timeout
* @returns
* @memberof Ping
*/
static async start(ipAddress, option) {
const result = await RNReactNativePing.start(ipAddress, option ?? {});
return result;
}
static async getTrafficStats() {
const result = await RNReactNativePing.getTrafficStats();
return result;
}
}
export default Ping;