2016-02-17 17:49:26 +08:00
|
|
|
import {Plugin, Cordova} from './plugin';
|
|
|
|
|
|
|
|
/**
|
2016-03-13 07:30:16 +08:00
|
|
|
* @name Clipboard
|
|
|
|
* @description
|
2016-02-17 17:49:26 +08:00
|
|
|
* Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
|
|
|
|
*
|
|
|
|
* Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
|
2016-03-05 05:42:21 +08:00
|
|
|
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
2016-02-17 17:49:26 +08:00
|
|
|
*
|
|
|
|
* @usage
|
|
|
|
* ```js
|
|
|
|
* Clipboard.copy("Hello world");
|
|
|
|
*
|
|
|
|
* Clipboard.paste().then(
|
|
|
|
* (resolve : string) => {
|
|
|
|
* alert(resolve);
|
|
|
|
* },
|
|
|
|
* (reject : string) => {
|
|
|
|
* alert("Error: " + reject);
|
|
|
|
* }
|
|
|
|
* );
|
|
|
|
* );
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-03-05 05:42:21 +08:00
|
|
|
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
|
2016-03-13 08:08:47 +08:00
|
|
|
pluginRef: 'cordova.plugins.clipboard',
|
|
|
|
repo: 'https://github.com/VersoSolutions/CordovaClipboard'
|
2016-02-17 17:49:26 +08:00
|
|
|
})
|
|
|
|
export class Clipboard {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies the given text
|
|
|
|
* @param text
|
|
|
|
* @returns {Promise<T>}
|
|
|
|
*/
|
2016-02-17 17:52:00 +08:00
|
|
|
@Cordova()
|
2016-03-11 05:48:20 +08:00
|
|
|
static copy(text: string): Promise<any> { return }
|
2016-02-17 17:49:26 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pastes the text stored in clipboard
|
|
|
|
* @returns {Promise<T>}
|
|
|
|
*/
|
2016-02-17 17:52:00 +08:00
|
|
|
@Cordova()
|
2016-03-11 05:48:20 +08:00
|
|
|
static paste(): Promise<any> { return }
|
2016-02-17 17:49:26 +08:00
|
|
|
|
|
|
|
}
|