mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +08:00
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:
parent
4694c422aa
commit
212bd63191
40
src/@ionic-native/plugins/dns/index.ts
Normal file
40
src/@ionic-native/plugins/dns/index.ts
Normal 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; }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user