mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 18:49:43 +08:00
docs(browser-tab): improve example
This commit is contained in:
parent
7ed6ab894b
commit
87ba4b4d32
@ -1,5 +1,5 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Browser Tab
|
||||
@ -13,21 +13,13 @@ import { Injectable } from '@angular/core';
|
||||
* constructor(private browserTab: BrowserTab) {
|
||||
*
|
||||
* browserTab.isAvailable()
|
||||
* .then((isAvailable: boolean) => {
|
||||
*
|
||||
* .then(isAvailable => {
|
||||
* if (isAvailable) {
|
||||
*
|
||||
* browserTab.openUrl('https://ionic.io');
|
||||
*
|
||||
* } else {
|
||||
*
|
||||
* // open URL with InAppBrowser instead or SafariViewController
|
||||
*
|
||||
* }
|
||||
*
|
||||
* });
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
@ -41,13 +33,14 @@ import { Injectable } from '@angular/core';
|
||||
})
|
||||
@Injectable()
|
||||
export class BrowserTab extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Check if BrowserTab option is available
|
||||
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
|
||||
*/
|
||||
@Cordova()
|
||||
isAvailable(): Promise<any> { return; }
|
||||
isAvailable(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Cordova()
|
||||
openUrl(url: string): Promise<any> { return; }
|
||||
openUrl(url: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes browser tab
|
||||
* @return {Promise<any>} Returns a promise that resolves when close was finished
|
||||
*/
|
||||
@Cordova()
|
||||
close(): Promise<any> { return; }
|
||||
close(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user