refactor(Httpd):
This commit is contained in:
parent
28ee511437
commit
1eed1a1cb3
@ -1,5 +1,7 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Httpd
|
* @name Httpd
|
||||||
* @description
|
* @description
|
||||||
@ -7,55 +9,57 @@ import {Observable} from 'rxjs/Observable';
|
|||||||
* @usage
|
* @usage
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
|
||||||
pluginRef: 'cordova.plugins.CorHttpd',
|
pluginRef: 'cordova.plugins.CorHttpd',
|
||||||
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
repo: 'https://github.com/floatinghotpot/cordova-httpd',
|
||||||
platforms: ['iOS', 'Android']
|
platforms: ['iOS', 'Android']
|
||||||
})
|
})
|
||||||
export class Httpd {
|
export class Httpd {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a web server.
|
* Starts a web server.
|
||||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||||
* @param options {HttpdOptions}
|
* @param options {HttpdOptions}
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
observable: true,
|
observable: true,
|
||||||
clearFunction: 'stopServer'
|
clearFunction: 'stopServer'
|
||||||
})
|
})
|
||||||
static startServer(options: any): Observable<string> {return; }
|
static startServer(options: any): Observable<string> { return; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL of the running server
|
* Gets the URL of the running server
|
||||||
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
|
* @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static getUrl(): Promise<string> {return; }
|
static getUrl(): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the local path of the running webserver
|
||||||
|
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static getLocalPath(): Promise<string> { return; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the local path of the running webserver
|
|
||||||
* @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
static getLocalPath(): Promise<string> {return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These options are used for the Httpd.startServer() function.
|
* These options are used for the Httpd.startServer() function.
|
||||||
*/
|
*/
|
||||||
export interface HttpdOptions {
|
export interface HttpdOptions {
|
||||||
/**
|
/**
|
||||||
* The public root directory for your web server. This path is relative to your app's www directory.
|
* The public root directory for your web server. This path is relative to your app's www directory.
|
||||||
* Default is current directory.
|
* Default is current directory.
|
||||||
*/
|
*/
|
||||||
www_root?: string;
|
www_root?: string;
|
||||||
/**
|
/**
|
||||||
* The port number to use.
|
* The port number to use.
|
||||||
* Default is 8888
|
* Default is 8888
|
||||||
*/
|
*/
|
||||||
port?: number;
|
port?: number;
|
||||||
/**
|
/**
|
||||||
* Setting this option to false will allow remote access to your web server (over any IP).
|
* Setting this option to false will allow remote access to your web server (over any IP).
|
||||||
* Default is false.
|
* Default is false.
|
||||||
*/
|
*/
|
||||||
localhost_only?: boolean;
|
localhost_only?: boolean;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user