From fa4c266cb7ef5860999a8b5352b5de0c2c49651d Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Wed, 17 Feb 2016 04:49:26 -0500 Subject: [PATCH] feat(): add clipboard plugin --- src/plugins/clipboard.ts | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/plugins/clipboard.ts diff --git a/src/plugins/clipboard.ts b/src/plugins/clipboard.ts new file mode 100644 index 000000000..b97adad2a --- /dev/null +++ b/src/plugins/clipboard.ts @@ -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} + */ + @Cordova + static copy(text : string) : Promise { + return new Promise((res, resj) => {}); + } + + /** + * Pastes the text stored in clipboard + * @returns {Promise} + */ + @Cordova + static paste() : Promise { + return new Promise((res, rej) => {}); + } + +}