2017-03-02 08:41:54 +08:00
import { Plugin , Cordova } from './plugin' ;
/ * *
* @name BrowserTab
* @description
2017-03-02 08:45:46 +08:00
* This plugin provides an interface to in - app browser tabs that exist on some mobile platforms , specifically [ Custom Tabs ] ( http : //developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
2017-03-02 08:41:54 +08:00
*
* @usage
* ` ` `
* import { BrowserTab } from 'ionic-native' ;
*
2017-03-02 08:45:46 +08:00
* BrowserTab . isAvailable ( )
* . then ( ( isAvailable : boolean ) = > {
*
* if ( isAvailable ) {
*
* BrowserTab . openUrl ( 'https://ionic.io' ) ;
*
* } else {
* // open url with InAppBrowser instead
* }
*
* } ) ;
2017-03-02 08:41:54 +08:00
*
* ` ` `
* /
@Plugin ( {
pluginName : 'BrowserTab' ,
2017-03-02 08:45:46 +08:00
plugin : 'cordova-plugin-browsertab' ,
pluginRef : 'cordova.plugins.browsertab' ,
repo : 'https://github.com/google/cordova-plugin-browsertab' ,
2017-03-02 08:41:54 +08:00
platforms : [ 'Android' , 'iOS' ]
} )
export class BrowserTab {
/ * *
* Check if BrowserTab option is available
* @return { Promise < any > } Returns a promise that resolves when check is successful and returns true or false
* /
@Cordova ( )
2017-03-02 08:45:46 +08:00
static isAvailable ( ) : Promise < any > { return ; }
2017-03-02 08:41:54 +08:00
/ * *
* Opens the provided URL using a browser tab
* @param { string } url The URL you want to open
* @return { Promise < any > } Returns a promise that resolves when check open was successful
* /
@Cordova ( )
2017-03-02 08:45:46 +08:00
static openUrl ( url : string ) : Promise < any > { return ; }
2017-03-02 08:41:54 +08:00
/ * *
* Closes browser tab
* @return { Promise < any > } Returns a promise that resolves when close was finished
* /
@Cordova ( )
2017-03-02 08:45:46 +08:00
static close ( ) : Promise < any > { return ; }
2017-03-02 08:41:54 +08:00
}