cordova-plugin-ping
This plugin implements the ping
software utility.
Supported Platforms
- Android
- iOS
Installation
cordova plugin add cordova-plugin-ping
or
cordova plugin add https://github.com/t1st3/cordova-plugin-ping.git
Usage
This plugin defines a global Ping
object.
Although the object is in the global scope, it is not available until after the deviceready
event.
Ping a domain
- query : Domain or IP address to ping.
- timeout : Time to wait for a response, in seconds.
- retry : Number of echo requests to send.
- version : Ping IPv4 or IPv6 address (Ping or Ping6).
document; { var p success err ipList; ipList = query: 'www.tiste.org' timeout: 1retry: 3version:'v4' query: 'www.somesite.com' timeout: 2'retry': 3version:'v6'; { console; }; { console; }; p = ; p;}
API
Ping.ping
This method takes the following arguments:
- ipList: an array of json objects with parameters : domain to query, retry, timeout and version.
- success: a callback function that handles success
- err: a callback function that handles error
The callback function for success takes one argument, which is a JSON array of results:
The callback function for error takes one argument, which is the error emitted.
License
This project is licensed under the MIT license. Check the license file.