node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org »

nativescript-clipboard

NativeScript Clipboard

NPM version Downloads Twitter Follow

A NativeScript plugin to copy and paste data from and to the device clipboard.

Installation

Run the following command from the root of your project:

tns plugin add nativescript-clipboard

Usage

To use this plugin you must first require() it:

var clipboard = require("nativescript-clipboard");

setText

  clipboard.setText("Something relevant to put on the clipboard.").then(function() {
      console.log("OK, copied to the clipboard");
  })

getText

  clipboard.getText().then(function(content) {
      console.log("Read from clipboard: " + content);
  })

Future work

Implement support for storing data (image, etc) on the clipboard. Open an issue or PR in case you like to have that.