mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 18:49:43 +08:00
feat(): add clipboard plugin
This commit is contained in:
parent
44d6d5c021
commit
fa4c266cb7
53
src/plugins/clipboard.ts
Normal file
53
src/plugins/clipboard.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
/**
|
||||
* Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
|
||||
*
|
||||
* Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
|
||||
*
|
||||
* ```
|
||||
* ionic plugin add https://github.com/VersoSolutions/CordovaClipboard.git
|
||||
* ````
|
||||
*
|
||||
* @usage
|
||||
* ```js
|
||||
* Clipboard.copy("Hello world");
|
||||
*
|
||||
* Clipboard.paste().then(
|
||||
* (resolve : string) => {
|
||||
* alert(resolve);
|
||||
* },
|
||||
* (reject : string) => {
|
||||
* alert("Error: " + reject);
|
||||
* }
|
||||
* );
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'Clipboard',
|
||||
plugin: 'com.verso.cordova.clipboard',
|
||||
pluginRef: 'cordova.plugins.clipboard'
|
||||
})
|
||||
export class Clipboard {
|
||||
|
||||
/**
|
||||
* Copies the given text
|
||||
* @param text
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
@Cordova
|
||||
static copy(text : string) : Promise<any> {
|
||||
return new Promise((res, resj) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pastes the text stored in clipboard
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
@Cordova
|
||||
static paste() : Promise<any> {
|
||||
return new Promise((res, rej) => {});
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user