mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
d827db27b0
BREAKING CHANGE: This reverts commit c5ae6362d7
.
61 lines
1.9 KiB
Cheetah
61 lines
1.9 KiB
Cheetah
/**
|
|
* 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
|
|
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added
|
|
* - Remove this note
|
|
*
|
|
*/
|
|
import { Injectable } from '@angular/core';
|
|
import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
|
|
import { Observable } from 'rxjs';
|
|
|
|
/**
|
|
* @name {{ Plugin_Name }}
|
|
* @description
|
|
* This plugin does something
|
|
*
|
|
* @usage
|
|
* ```typescript
|
|
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
|
|
*
|
|
*
|
|
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
|
|
*
|
|
* ...
|
|
*
|
|
*
|
|
* this.{{ pluginName }}.functionName('Hello', 123)
|
|
* .then((res: any) => console.log(res))
|
|
* .catch((error: any) => console.error(error));
|
|
*
|
|
* ```
|
|
*/
|
|
@Plugin({
|
|
pluginName: '{{ PluginName }}',
|
|
plugin: '', // npm package name, example: cordova-plugin-camera
|
|
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
|
repo: '', // the github repository URL for the plugin
|
|
install: '', // OPTIONAL install command, in case the plugin requires variables
|
|
installVariables: [], // OPTIONAL the plugin requires variables
|
|
platforms: [] // Array of platforms supported, example: ['Android', 'iOS']
|
|
})
|
|
@Injectable()
|
|
export class {{ PluginName }} extends IonicNativePlugin {
|
|
|
|
/**
|
|
* This function does something
|
|
* @param arg1 {string} Some param to configure something
|
|
* @param arg2 {number} Another param to configure something
|
|
* @return {Promise<any>} Returns a promise that resolves when something happens
|
|
*/
|
|
@Cordova()
|
|
functionName(arg1: string, arg2: number): Promise<any> {
|
|
return; // We add return; here to avoid any IDE / Compiler errors
|
|
}
|
|
|
|
}
|