• Stars
    star
    138
  • Rank 264,508 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“„ Copy text from browser to clipboard...natively! < 1kB

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 styfle

More Repositories

1

awesome-online-ide

๐ŸŒฉ๏ธ A list of awesome online development environments
2,919
star
2

packagephobia

โš–๏ธ Find the cost of adding a new dependency to your project
TypeScript
2,115
star
3

cancel-workflow-action

โน๏ธ GitHub Action to cancel previous running workflows on push
TypeScript
863
star
4

awesome-desktop-js

๐Ÿ–ฅ๏ธ A list of awesome packages and frameworks for implementing javascript applications on the desktop
740
star
5

breaking-changes-web

๐Ÿ’ข A list of breaking changes to the web platform
351
star
6

react-server-example-tsx

โš›๏ธ Boilerplate for isomorphic web app with React server-side rendering in TypeScript
TypeScript
277
star
7

links-awakening

๐Ÿ”— Recursively check a website for broken links
TypeScript
130
star
8

magnemite

โบ๏ธ Capture repro steps with this screen recorder for websites, powered by Electron
TypeScript
57
star
9

screenshot-v2

New here and want something similar? See https://github.com/vercel/og-image. Historian and want to see the original PR? See https://github.com/zeit/now-examples/pull/207
JavaScript
30
star
10

styfle.dev

๐Ÿ‘จโ€๐Ÿ’ป The source code for my website, built with Next.js and hosted on Vercel
TypeScript
23
star
11

geoslack

๐Ÿ“ Geolocate your team in Slack
TypeScript
18
star
12

doorbell

๐Ÿ›Ž๏ธ Virtual doorbell to notify Amazon Alexa devices
HTML
15
star
13

tls-check

โœ… Check the TLS protocol support of one or more web servers
JavaScript
13
star
14

typed-tmpl

๐Ÿ›กA typed, template module using ES6 Tagged Template Strings with TypeScript
JavaScript
6
star
15

The-Harvest-Club

๐ŸŠA student-designed Contact Management System for connecting volunteers and growers
PHP
6
star
16

exeggcute

๐Ÿฅš A node.js module to make executing shell cmds a breeze!
JavaScript
5
star
17

rediscovering-neverland

๐Ÿงšโ€โ™‚๏ธSlides from my Tech Talk given on January 23, 2020
HTML
5
star
18

Basic-Wars

๐ŸŽ–๏ธA turn-based strategy game written in pure Java
Java
4
star
19

dotfiles

โšซ My .bashrc .vimrc etc
Vim Script
3
star
20

tsc-example

Different ways to compile typescript
JavaScript
3
star
21

ncc-bug-socketio

A bug with ncc
JavaScript
2
star
22

ncc-bug-stack

JavaScript
2
star
23

device-width-detection

๐Ÿ“ฑGenerate dynamic SVG based on device srcset
JavaScript
2
star
24

ncc-bug-sourcemap

A bug with ncc
TypeScript
2
star
25

dotnet-api-example

Example of what a simple .NET API might look like
C#
1
star
26

ncc-bug-fluent-ffmpeg

JavaScript
1
star
27

micro-ts-example

Example of using micro with TypeScript
JavaScript
1
star
28

ncc-bug-npm

A bug when npm is a dependency
JavaScript
1
star
29

alexa-wunderground

๐Ÿ—ฃ๏ธ WIP - An Amazon Alexa skill for Weather Underground
JavaScript
1
star
30

xtend-es6

extend like a modern boss with Object.assign()
JavaScript
1
star
31

aws-xray-bug

aws xray issue #60
JavaScript
1
star
32

mma-api

๐Ÿ‘Š api for mma dataset
JavaScript
1
star
33

node-docker-echo

Example node.js echo environment variables in docker
JavaScript
1
star
34

node-http-log

โ“ log http request header & body to a file
JavaScript
1
star
35

bug-term-size-tput

Bug in `term-size`
JavaScript
1
star