docs(browser-tab): improve example

This commit is contained in:
Daniel 2018-04-08 19:18:36 +02:00
parent 7ed6ab894b
commit 87ba4b4d32

View File

@ -1,5 +1,5 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/** /**
* @name Browser Tab * @name Browser Tab
@ -13,21 +13,13 @@ import { Injectable } from '@angular/core';
* constructor(private browserTab: BrowserTab) { * constructor(private browserTab: BrowserTab) {
* *
* browserTab.isAvailable() * browserTab.isAvailable()
* .then((isAvailable: boolean) => { * .then(isAvailable => {
*
* if (isAvailable) { * if (isAvailable) {
*
* browserTab.openUrl('https://ionic.io'); * browserTab.openUrl('https://ionic.io');
*
* } else { * } else {
*
* // open URL with InAppBrowser instead or SafariViewController * // open URL with InAppBrowser instead or SafariViewController
*
* } * }
*
* }); * });
*
*
* } * }
* *
* ``` * ```
@ -41,13 +33,14 @@ import { Injectable } from '@angular/core';
}) })
@Injectable() @Injectable()
export class BrowserTab extends IonicNativePlugin { export class BrowserTab extends IonicNativePlugin {
/** /**
* Check if BrowserTab option is available * Check if BrowserTab option is available
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false * @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
*/ */
@Cordova() @Cordova()
isAvailable(): Promise<any> { return; } isAvailable(): Promise<any> {
return;
}
/** /**
* Opens the provided URL using a browser tab * Opens the provided URL using a browser tab
@ -55,12 +48,16 @@ export class BrowserTab extends IonicNativePlugin {
* @return {Promise<any>} Returns a promise that resolves when check open was successful * @return {Promise<any>} Returns a promise that resolves when check open was successful
*/ */
@Cordova() @Cordova()
openUrl(url: string): Promise<any> { return; } openUrl(url: string): Promise<any> {
return;
}
/** /**
* Closes browser tab * Closes browser tab
* @return {Promise<any>} Returns a promise that resolves when close was finished * @return {Promise<any>} Returns a promise that resolves when close was finished
*/ */
@Cordova() @Cordova()
close(): Promise<any> { return; } close(): Promise<any> {
return;
}
} }