A tiny copy to clipboard library, without any dependence. It is small(only 1.04k) and Simple to use in javascript.
- small
- simple
- useful
- support typescript
# install
npm install tiny-clipboard --save
import TinyClipboard from 'tiny-clipboard'
TinyClipboard.copy(text, callback)
or you can use it by script tag
<script src="https://unpkg.com/tiny-clipbord@0.0.3/libs/tiny-clipbord.umd.min.js"></script>
<script>
TinyClipboard.copy(text, callback)
</script>
-
TinyClipboard.copy(text, callback)
-
text: the text you want to copy
-
callback(error ?) After copying successfully it will be run, and when appear error that will throw the error
-
-
TinyClipboard.getHistory()
- return String[], the history that you have copied
-
TinyClipboard.clearHistroy()
clear the history
42+ ✔ | 41+ ✔ | 10+ ✔ | 29+ ✔ | 12+ ✔ | 9+ ✔ |
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
MIT Licensed © suporka
If you have some question or advise, you can send me a E-mail(zxpscau@163.com).