Skip to content

zxpsuper/tiny-clipboard

Repository files navigation

tiny-clipboard

Introduction

A tiny copy to clipboard library, without any dependence. It is small(only 1.04k) and Simple to use in javascript.

Features

  • small
  • simple
  • useful
  • support typescript

Usage

# 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>

Methods

  • 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

Browser Support

Chrome Firefox Safari Opera Edge Internet Explorer logo
42+ ✔ 41+ ✔ 10+ ✔ 29+ ✔ 12+ ✔ 9+ ✔

Contributing

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.

License

MIT Licensed © suporka

Questions or advise

If you have some question or advise, you can send me a E-mail(zxpscau@163.com).

About

Modern copy to clipboard.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published