mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 18:49:43 +08:00
docs(browser-tab): add proper docs
This commit is contained in:
parent
8de37939fb
commit
281e37ee04
@ -1,37 +1,34 @@
|
|||||||
/**
|
|
||||||
* This is a template for new plugin wrappers
|
|
||||||
*
|
|
||||||
* TODO:
|
|
||||||
* - Add/Change information below
|
|
||||||
* - Document usage (importing, executing main functionality)
|
|
||||||
* - Remove any imports that you are not using
|
|
||||||
* - Add this file to /src/index.ts (follow style of other plugins)
|
|
||||||
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
|
|
||||||
* - Remove this note
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
import { Plugin, Cordova } from './plugin';
|
import { Plugin, Cordova } from './plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name BrowserTab
|
* @name BrowserTab
|
||||||
* @description
|
* @description
|
||||||
* This plugin does something
|
* 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.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```
|
* ```
|
||||||
* import { BrowserTab } from 'ionic-native';
|
* import { BrowserTab } from 'ionic-native';
|
||||||
*
|
*
|
||||||
* BrowserTab.functionName('Hello', 123)
|
* BrowserTab.isAvailable()
|
||||||
* .then((something: any) => doSomething(something))
|
* .then((isAvailable: boolean) => {
|
||||||
* .catch((error: any) => console.log(error));
|
*
|
||||||
|
* if (isAvailable) {
|
||||||
|
*
|
||||||
|
* BrowserTab.openUrl('https://ionic.io');
|
||||||
|
*
|
||||||
|
* } else {
|
||||||
|
* // open url with InAppBrowser instead
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* });
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'BrowserTab',
|
pluginName: 'BrowserTab',
|
||||||
plugin: 'cordova-plugin-browsertab', // npm package name, example: cordova-plugin-camera
|
plugin: 'cordova-plugin-browsertab',
|
||||||
pluginRef: 'cordova.plugins.browsertab', // the variable reference to call the plugin, example: navigator.geolocation
|
pluginRef: 'cordova.plugins.browsertab',
|
||||||
repo: 'https://github.com/google/cordova-plugin-browsertab', // the github repository URL for the plugin
|
repo: 'https://github.com/google/cordova-plugin-browsertab',
|
||||||
platforms: ['Android', 'iOS']
|
platforms: ['Android', 'iOS']
|
||||||
})
|
})
|
||||||
export class BrowserTab {
|
export class BrowserTab {
|
||||||
@ -41,9 +38,7 @@ export class BrowserTab {
|
|||||||
* @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()
|
||||||
static isAvailable(): Promise<any> {
|
static isAvailable(): Promise<any> { return; }
|
||||||
return; // We add return; here to avoid any IDE / Compiler errors
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the provided URL using a browser tab
|
* Opens the provided URL using a browser tab
|
||||||
@ -51,16 +46,12 @@ export class BrowserTab {
|
|||||||
* @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()
|
||||||
static openUrl(url: string): Promise<any> {
|
static openUrl(url: string): Promise<any> { return; }
|
||||||
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()
|
||||||
static close(): Promise<any> {
|
static close(): Promise<any> { return; }
|
||||||
return; // We add return; here to avoid any IDE / Compiler errors
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user