Clipboard

You may save text to your device clipboard and retrieve the current clipboard contents via the GoNative JavaScript Bridge.

Save to Clipboard

↔️GoNative JavaScript Bridge

Run the following GoNative JavaScript Bridge command to save text to the device clipboard:

gonative.clipboard.set({"data": "Save to Clipboard"});

Retrieve from Clipboard

↔️GoNative JavaScript Bridge

Run the following GoNative JavaScript Bridge command to retrieve the latest item from the device clipboard using a promise:

gonative.clipboard.get().then(function (result){
   if (result.data) {
      alert('Received Clipboard item: ', result.data); 
    } else { // error receiving clipboard item
       alert(result.error); 
    }
});

Or using a callback function:

gonative.clipboard.get({"callback": "clipboardCallback"});

function clipboardCallback(result) { 
   if (result.data) {
      alert('Received Clipboard item: ', result.data); 
   } else { // error receiving clipboard item
      alert(result.error); 
   }
}