# cordova-plugin-ping-with-ip

> Cordova Ping Plugin Whit IP

Latest version **1.0.2** (published 2022-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-ping-with-ip
pnpm add cordova-plugin-ping-with-ip
yarn add cordova-plugin-ping-with-ip
bun add cordova-plugin-ping-with-ip
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-04-25 |
| First published | 2022-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Navid Mlk |
| Maintainers | navidmalekan |
| Keywords | cordova, ping, ecosystem:cordova, cordova-android |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-ping-with-ip
- Repository: https://github.com/navidmalekan/cordova-plugin-ping-with-ip
- Homepage: https://github.com/navidmalekan/cordova-plugin-ping-with-ip#readme
- Issues: https://github.com/navidmalekan/cordova-plugin-ping-with-ip/issues
- npm.io page: https://npm.io/package/cordova-plugin-ping-with-ip

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-04-25
- 1.0.1 — 2022-04-25
- 1.0.0 — 2022-04-25

## README

## Installation

> cordova plugin add https://github.com/adnofer/cordova-plugin-ping-with-ip.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
        
```js
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
  var p, success, err, ipList;
  ipList = ['tiste.org'];
  success = function (results) {
    console.log(results);
  };
  err = function (e) {
    console.log('Error: ' + e);
  };
  p = new Ping();
  p.ping(ipList, success, err);
}
```

### Ping an IPv4 address

```js
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
  var p, success, err, ipList;
  ipList = ['192.168.1.254'];
  success = function (results) {
    console.log(results);
  };
  err = function (e) {
    console.log('Error: ' + e);
  };
  p = new Ping();
  p.ping(ipList, success, err);
}
```

### Ping multiple domains or IP addresses

```js
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
  var p, success, err, ipList;
  ipList = ['tiste.org', 'undefineddomain.com', '192.168.1.254'];
  success = function (results) {
    console.log(results);
  };
  err = function (e) {
    console.log('Error: ' + e);
  };
  p = new Ping();
  p.ping(ipList, success, err);
}
```

## Methods

- Ping.ping

## Ping.ping

This method takes the following arguments:

* ipList: an array of domain names or IP addresses
* 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:

```json
[
  {
    "target": "github.com",
	"ip": "140.82.121.4",
    "status": "success",
    "avg": 40.131
  },
  {
    "target": "undefineddomain.com",
	"ip": "140.82.121.4",
    "status": "timeout",
    "avg": 0
  },
  {
    "target": "192.168.1.1",
	"ip": "192.168.1.1",
    "status": "success",
    "avg": 35.654
  }
]
```

The callback function for error takes one argument, which is the error emitted.

### Supported Platforms

- Android


*****

## License

This project is licensed under the [MIT license](https://opensource.org/licenses/MIT). Check the [LICENSE.md file](https://github.com/t1st3/cordova-plugin-ping/blob/master/LICENSE.md).

---
_Source: https://npm.io/package/cordova-plugin-ping-with-ip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
