Skip to content

Commit

Permalink
(feat) added cordova-plugin-browsertab support
Browse files Browse the repository at this point in the history
  • Loading branch information
mru committed Feb 21, 2017
1 parent ba0f6ec commit 00eb5cf
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { ActionSheet } from './plugins/actionsheet';
import { AdMob } from './plugins/admob';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
import { AppAvailability } from './plugins/appavailability';
import { AppRate } from './plugins/apprate';
import { AppPreferences } from './plugins/apppreferences';
import { AppRate } from './plugins/apprate';
import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundGeolocation } from './plugins/background-geolocation';
Expand All @@ -22,6 +22,7 @@ import { Brightness } from './plugins/brightness';
import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Broadcaster } from './plugins/broadcaster';
import { BrowserTab } from './plugins/browser-tab';
import { Calendar } from './plugins/calendar';
import { CallNumber } from './plugins/call-number';
import { Camera } from './plugins/camera';
Expand Down Expand Up @@ -145,6 +146,7 @@ export * from './plugins/ble';
export * from './plugins/bluetoothserial';
export * from './plugins/brightness';
export * from './plugins/broadcaster';
export * from './plugins/browser-tab';
export * from './plugins/calendar';
export * from './plugins/call-number';
export * from './plugins/camera';
Expand Down Expand Up @@ -270,6 +272,7 @@ window['IonicNative'] = {
BLE,
BluetoothSerial,
Broadcaster,
BrowserTab,
Calendar,
CallNumber,
Camera,
Expand Down
57 changes: 57 additions & 0 deletions src/plugins/browser-tab.ts
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; }

}

0 comments on commit 00eb5cf

Please sign in to comment.