Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ferrriii/text-copy
a small js library for copying text to clipboard
https://github.com/ferrriii/text-copy
clipboard js-library npm-package
Last synced: 3 days ago
JSON representation
a small js library for copying text to clipboard
- Host: GitHub
- URL: https://github.com/ferrriii/text-copy
- Owner: ferrriii
- License: mit
- Created: 2019-11-27T10:23:42.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T13:08:51.000Z (over 3 years ago)
- Last Synced: 2024-11-07T05:39:30.692Z (12 days ago)
- Topics: clipboard, js-library, npm-package
- Language: JavaScript
- Homepage:
- Size: 31.3 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# text-copy
a small js library ( ) for copying text to clipboard.
Tested on: Chrome, Firefox, Safari, Edge and IE11.
## Browser usage
Load `index.js`. You can use a CDN like below.
``````
Then `CopyText` function is availabe. Use it like below.```
copy
````CopyText()` returns `true` if text is successfully copied.
## NPM usage
If you want to use it in JS frameworks like Vue or React, install it as below.
```
npm i text-copy
```
and then use it as below
```
import copy from 'text-copy'// some where it the code
let isCopied = copy('text to copy')
```**Note**: copy function should be called inside a user-generated event listener.