Add clipboard plugin
This commit is contained in:
parent
fe53f1b87c
commit
66482cd9e2
4 changed files with 110 additions and 1 deletions
36
mobile/plugins/com.verso.cordova.clipboard/www/clipboard.js
Normal file
36
mobile/plugins/com.verso.cordova.clipboard/www/clipboard.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
cordova.define("com.verso.cordova.clipboard.Clipboard", function(require, exports, module) { var cordova = require('cordova');
|
||||
|
||||
/**
|
||||
* Clipboard plugin for Cordova
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function Clipboard () {}
|
||||
|
||||
/**
|
||||
* Sets the clipboard content
|
||||
*
|
||||
* @param {String} text The content to copy to the clipboard
|
||||
* @param {Function} onSuccess The function to call in case of success (takes the copied text as argument)
|
||||
* @param {Function} onFail The function to call in case of error
|
||||
*/
|
||||
Clipboard.prototype.copy = function (text, onSuccess, onFail) {
|
||||
if (typeof text === "undefined" || text === null) text = "";
|
||||
cordova.exec(onSuccess, onFail, "Clipboard", "copy", [text]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the clipboard content
|
||||
*
|
||||
* @param {Function} onSuccess The function to call in case of success
|
||||
* @param {Function} onFail The function to call in case of error
|
||||
*/
|
||||
Clipboard.prototype.paste = function (onSuccess, onFail) {
|
||||
cordova.exec(onSuccess, onFail, "Clipboard", "paste", []);
|
||||
};
|
||||
|
||||
// Register the plugin
|
||||
var clipboard = new Clipboard();
|
||||
module.exports = clipboard;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue