copee
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

copee

npm size install size Downloads Dependency Status devDependency Status Build Status

Copy text from browser to clipboard...natively! Less than 1 kB!

Have you ever wanted to send a string to the user's clipboard? Front-end developers have invented many hacks to get around this limitation...until now!

Introducing copee, a micro-wrapper around the browser's native "copy text" API 🗜️

Death to Adobe Flash 💀

Demo

Try the demo to see copee in action!

You can view the page source to quickly learn how to use it.

Also, read this blog post for some background.

Browser ESM Usage

<script type="module">
    import { toClipboard } from 'https://cdn.jsdelivr.net/npm/copee/dist/copee.mjs';
 
    document.getElementById('btn').addEventListener('click', () => {
        const success = toClipboard('Wow, "copee" works via ES Modules!');
        if (success) {
            // it worked, check your clipboard!
        }
    });
</script> 

Browser UMD Usage

<script src="https://cdn.jsdelivr.net/npm/copee/dist/copee.umd.js"></script>
<script type="text/javascript">
    document.getElementById('btn').addEventListener('click', function () {
        var success = copee.toClipboard('Wow, "copee" works!');
        if (success) {
            // it worked, check your clipboard!
        }
    });
</script> 

Browser Suppport

  • UMD (.js) supports IE 11+, Chrome 43+, Opera 29+, and Firefox 41+
  • ESM (.mjs) supports Chrome 61+, Safari 10.1+, Edge 16+, and Firefox 60+

Prior Art

This package was influenced by the following:

Authors

Developed by ceriously.com

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.692latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.692
1.0.50
1.0.41
1.0.31
1.0.29
1.0.10
1.0.08
0.1.60
0.1.54
0.1.41
0.1.32
0.1.20
0.1.115
0.1.00
0.0.10

Package Sidebar

Install

npm i copee

Weekly Downloads

133

Version

1.0.6

License

MIT

Unpacked Size

9.91 kB

Total Files

7

Last publish

Collaborators

  • styfle