Skip to content
📋 NativeScript plugin to copy stuff to the device clipboard, and read from it again
TypeScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github - setText not working on android #9 Sep 5, 2019
demo - setText not working on android #9 Sep 5, 2019
publish - setText not working on android #9 Sep 5, 2019
src - setText not working on android #9 Sep 5, 2019
.gitignore
.travis.yml CI Sep 5, 2019
LICENSE - setText not working on android #9 Sep 5, 2019
README.md
tslint.json

README.md

NativeScript Clipboard

Build Status NPM version Downloads TotalDownloads 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

TIP: Check out the demo app for TypeScript examples.

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");
  })

setTextSync

This is the synchronous version of setText, available since plugin version 1.2.0.

  clipboard.setTextSync("Something relevant to put on the clipboard.");

getText

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

getTextSync

This is the synchronous version of getText, available since plugin version 1.2.0.

  var content = clipboard.getText();
  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.

You can’t perform that action at this time.