v0.8+ (developing)
clipboard allows you to getString()
or setString()
from the system clipboard.
Not long ago, We're still suffering from such a situation that we got a verification code sent by SMS, and we had no way to get the code from the SMS text but to typed it by our hands. How frustrated it is! But now you can enable your app to get the code from the system clipboard by calling clipboard.getString()
.
reads from clipboard.
callback(function)
: the callback function after executing this action. data
is the return value.
Example
var clipboard = require('@weex-module/clipboard'); clipboard.getString(function(ret) { // callback. 'ret' is an object that contains 'result' and 'data'. // use 'ret.data' to fetch the value. console.log("read from clipboard is " + ret.data); });
sets the text to clipboard, having the same effect as copying manually.
text(string)
: the text copied to clipboard. Example
var clipboard = require('@weex-module/clipboard'); clipboard.setString("SomeStringHere");