From 1eed1a1cb34f8a26c62a6f5336d57cc284168b56 Mon Sep 17 00:00:00 2001 From: Guille Date: Sun, 17 Jul 2016 19:53:58 +0200 Subject: [PATCH] refactor(Httpd): --- src/plugins/httpd.ts | 92 +++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/src/plugins/httpd.ts b/src/plugins/httpd.ts index c948d02f..3aa5fed2 100644 --- a/src/plugins/httpd.ts +++ b/src/plugins/httpd.ts @@ -1,5 +1,7 @@ -import {Plugin, Cordova} from './plugin'; -import {Observable} from 'rxjs/Observable'; +import { Cordova, Plugin } from './plugin'; +import { Observable } from 'rxjs/Observable'; + + /** * @name Httpd * @description @@ -7,55 +9,57 @@ import {Observable} from 'rxjs/Observable'; * @usage */ @Plugin({ - plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', - pluginRef: 'cordova.plugins.CorHttpd', - repo: 'https://github.com/floatinghotpot/cordova-httpd', - platforms: ['iOS', 'Android'] + plugin: 'https://github.com/floatinghotpot/cordova-httpd.git', + pluginRef: 'cordova.plugins.CorHttpd', + repo: 'https://github.com/floatinghotpot/cordova-httpd', + platforms: ['iOS', 'Android'] }) export class Httpd { - /** - * Starts a web server. - * @returns {Observable} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server. - * @param options {HttpdOptions} - */ - @Cordova({ - observable: true, - clearFunction: 'stopServer' - }) - static startServer(options: any): Observable {return; } + /** + * Starts a web server. + * @returns {Observable} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server. + * @param options {HttpdOptions} + */ + @Cordova({ + observable: true, + clearFunction: 'stopServer' + }) + static startServer(options: any): Observable { return; } - /** - * Gets the URL of the running server - * @returns {Promise} Returns a promise that resolves with the URL of the web server. - */ - @Cordova() - static getUrl(): Promise {return; } + /** + * Gets the URL of the running server + * @returns {Promise} Returns a promise that resolves with the URL of the web server. + */ + @Cordova() + static getUrl(): Promise { return; } + + /** + * Get the local path of the running webserver + * @returns {Promise} Returns a promise that resolves with the local path of the web server. + */ + @Cordova() + static getLocalPath(): Promise { return; } - /** - * Get the local path of the running webserver - * @returns {Promise} Returns a promise that resolves with the local path of the web server. - */ - @Cordova() - static getLocalPath(): Promise {return; } } + /** * These options are used for the Httpd.startServer() function. */ export interface HttpdOptions { - /** - * The public root directory for your web server. This path is relative to your app's www directory. - * Default is current directory. - */ - www_root?: string; - /** - * The port number to use. - * Default is 8888 - */ - port?: number; - /** - * Setting this option to false will allow remote access to your web server (over any IP). - * Default is false. - */ - localhost_only?: boolean; -} \ No newline at end of file + /** + * The public root directory for your web server. This path is relative to your app's www directory. + * Default is current directory. + */ + www_root?: string; + /** + * The port number to use. + * Default is 8888 + */ + port?: number; + /** + * Setting this option to false will allow remote access to your web server (over any IP). + * Default is false. + */ + localhost_only?: boolean; +}