feat(dns): add cordova-plugin-dns plugin (#2083)

* feat(cordova-plugin-dns added): Resolve hostnames into an underlying network address.

* Update index.ts
This commit is contained in:
Precious Jahlom Agboado 2017-12-08 20:09:07 +00:00 committed by Ibby Hadeed
parent 4694c422aa
commit 212bd63191

View File

@ -0,0 +1,40 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name DNS
* @description A plugin for Apache Cordova that enables applications to manually resolve hostnames into an underlying network address. This is mostly useful for determining whether there is a problem with the device's DNS server configuration.
*
* @usage
* ```typescript
* import { DNS } from '@ionic-native/dns';
*
*
* constructor(private dns: DNS) { }
*
* ...
* this.dns.resolve(hostname)
* .then(
* address => console.log('Resolved ' + hostname + ' to ' + address),
* error => console.log('Failed to resolve ' + hostname + ': ' + error)
* );
*
* ```
*/
@Plugin({
pluginName: 'DNS',
plugin: 'cordova-plugin-dns',
pluginRef: 'cordova.plugins.dns',
repo: 'https://bitbucket.org/zegeba/cordova-plugin-dns',
platforms: ['Android']
})
@Injectable()
export class DNS extends IonicNativePlugin {
/**
* Resolve hostnames into an underlying network address.
* @param hostname
* @returns {Promise<string>} Returns a promise that resolves with the resolution.
*/
@Cordova()
resolve(hostname: string): Promise<string> { return; }
}