|
| 1 | +/** |
| 2 | + * This is a template for new plugin wrappers |
| 3 | + * |
| 4 | + * TODO: |
| 5 | + * - Add/Change information below |
| 6 | + * - Document usage (importing, executing main functionality) |
| 7 | + * - Remove any imports that you are not using |
| 8 | + * - Add this file to /src/index.ts (follow style of other plugins) |
| 9 | + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs. |
| 10 | + * - Remove this note |
| 11 | + * |
| 12 | + */ |
| 13 | +import { Plugin, Cordova } from './plugin'; |
| 14 | + |
| 15 | +/** |
| 16 | + * @name BrowserTab |
| 17 | + * @description |
| 18 | + * This plugin does something |
| 19 | + * |
| 20 | + * @usage |
| 21 | + * ``` |
| 22 | + * import { BrowserTab } from 'ionic-native'; |
| 23 | + * |
| 24 | + * BrowserTab.functionName('Hello', 123) |
| 25 | + * .then((something: any) => doSomething(something)) |
| 26 | + * .catch((error: any) => console.log(error)); |
| 27 | + * |
| 28 | + * ``` |
| 29 | + */ |
| 30 | +@Plugin({ |
| 31 | + pluginName: 'BrowserTab', |
| 32 | + plugin: 'cordova-plugin-browsertab', // npm package name, example: cordova-plugin-camera |
| 33 | + pluginRef: 'cordova.plugins.browsertab', // the variable reference to call the plugin, example: navigator.geolocation |
| 34 | + repo: 'https://github.com/google/cordova-plugin-browsertab', // the github repository URL for the plugin |
| 35 | + platforms: ['Android', 'iOS'] |
| 36 | +}) |
| 37 | +export class BrowserTab { |
| 38 | + |
| 39 | + /** |
| 40 | + * Check if BrowserTab option is available |
| 41 | + * @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false |
| 42 | + */ |
| 43 | + @Cordova() |
| 44 | + static isAvailable(): Promise<any> { |
| 45 | + return; // We add return; here to avoid any IDE / Compiler errors |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Opens the provided URL using a browser tab |
| 50 | + * @param {string} url The URL you want to open |
| 51 | + * @return {Promise<any>} Returns a promise that resolves when check open was successful |
| 52 | + */ |
| 53 | + @Cordova() |
| 54 | + static openUrl(url: string): Promise<any> { |
| 55 | + return; |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Closes browser tab |
| 60 | + * @return {Promise<any>} Returns a promise that resolves when close was finished |
| 61 | + */ |
| 62 | + @Cordova() |
| 63 | + static close(): Promise<any> { |
| 64 | + return; // We add return; here to avoid any IDE / Compiler errors |
| 65 | + } |
| 66 | +} |
0 commit comments