From 212bd631911bcca44278cc6b3373afdb05b8d424 Mon Sep 17 00:00:00 2001 From: Precious Jahlom Agboado Date: Fri, 8 Dec 2017 20:09:07 +0000 Subject: [PATCH] feat(dns): add cordova-plugin-dns plugin (#2083) * feat(cordova-plugin-dns added): Resolve hostnames into an underlying network address. * Update index.ts --- src/@ionic-native/plugins/dns/index.ts | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/@ionic-native/plugins/dns/index.ts diff --git a/src/@ionic-native/plugins/dns/index.ts b/src/@ionic-native/plugins/dns/index.ts new file mode 100644 index 000000000..ece314ed8 --- /dev/null +++ b/src/@ionic-native/plugins/dns/index.ts @@ -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} Returns a promise that resolves with the resolution. + */ + @Cordova() + resolve(hostname: string): Promise { return; } +}