Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eddyverbruggen/nativescript-clipboard
:clipboard: NativeScript plugin to copy stuff to the device clipboard, and read from it again
https://github.com/eddyverbruggen/nativescript-clipboard
clipboard nativescript nativescript-plugin pasteboard
Last synced: 7 days ago
JSON representation
:clipboard: NativeScript plugin to copy stuff to the device clipboard, and read from it again
- Host: GitHub
- URL: https://github.com/eddyverbruggen/nativescript-clipboard
- Owner: EddyVerbruggen
- License: mit
- Created: 2015-05-10T16:21:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T00:54:07.000Z (over 1 year ago)
- Last Synced: 2024-09-22T14:32:19.321Z (11 days ago)
- Topics: clipboard, nativescript, nativescript-plugin, pasteboard
- Language: TypeScript
- Homepage:
- Size: 3.3 MB
- Stars: 40
- Watchers: 5
- Forks: 10
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NativeScript Clipboard
[![Build Status][build-status]][build-url]
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![TotalDownloads][total-downloads-image]][npm-url]
[![Twitter Follow][twitter-image]][twitter-url][build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-clipboard.svg?branch=master
[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-clipboard
[npm-image]:http://img.shields.io/npm/v/nativescript-clipboard.svg
[npm-url]:https://npmjs.org/package/nativescript-clipboard
[downloads-image]:http://img.shields.io/npm/dm/nativescript-clipboard.svg
[total-downloads-image]:http://img.shields.io/npm/dt/nativescript-clipboard.svg?label=total%20downloads
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
[twitter-url]:https://twitter.com/eddyverbruggenA NativeScript plugin to copy and paste data from and to the device clipboard.
> 💡 Plugin version 2.0.0+ is compatible with NativeScript 7+. If you need to target older NativeScript versions, please stick to plugin version 1.2.0.
## Installation
Run the following command from the root of your project:```
tns plugin add nativescript-clipboard
```## Usage
> TIP: Check out the [demo app](/demo) for TypeScript examples.
To use this plugin you must first require() it:
```js
var clipboard = require("nativescript-clipboard");
```### setText
```js
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.```js
clipboard.setTextSync("Something relevant to put on the clipboard.");
```### getText
```js
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.```js
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.