forked from danielsogl/awesome-cordova-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) added cordova-plugin-browsertab support
- Loading branch information
mru
committed
Feb 21, 2017
1 parent
ba0f6ec
commit 00eb5cf
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Plugin, Cordova } from './plugin'; | ||
|
||
/** | ||
* @name BrowserTab | ||
* @description | ||
* This plugin opens a new tab in the system prefered browser | ||
* | ||
* @usage | ||
* ``` | ||
* import { BrowserTab } from 'ionic-native'; | ||
* | ||
* const URL = 'http://ionicframework.com/docs/' | ||
* | ||
* BrowserTab.isAvailable() | ||
* .then((result) => { | ||
* console.log('BrowserTab is available'); | ||
* | ||
* BrowserTab.openUrl(URL).catch((error) => { console.log(error); }); | ||
* | ||
* }).catch((error) => { | ||
* console.log('BrowserTab is not available'); | ||
* }); | ||
* | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'BrowserTab', | ||
plugin: 'cordova-plugin-browsertab', // npm package name, example: cordova-plugin-camera | ||
pluginRef: 'cordova.plugins.browsertab', // the variable reference to call the plugin, example: navigator.geolocation | ||
repo: 'https://github.com/google/cordova-plugin-browsertab', // the github repository URL for the plugin | ||
}) | ||
export class BrowserTab { | ||
|
||
/** | ||
* This function test if browserTab is available or not | ||
* @return {Promise<any>} Returns a promise | ||
*/ | ||
@Cordova() | ||
static isAvailable(): Promise<any> { return; } | ||
|
||
/** | ||
* This function opens a new tab in the system default browser | ||
* @param url {string} URL to open | ||
* @return {Promise<any>} Returns a promise | ||
*/ | ||
@Cordova() | ||
static openUrl(url: string): Promise<any> { return; } | ||
|
||
/** | ||
* This function closes a tab | ||
* @return {Promise<any>} Returns a promise | ||
*/ | ||
@Cordova() | ||
static close(): Promise<any> { return; } | ||
|
||
} |