![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
clipboard-copy
Advanced tools
The clipboard-copy npm package provides a simple and efficient way to copy text to the clipboard in web applications. It is designed to be lightweight and easy to use, making it a popular choice for developers who need to implement clipboard functionality.
Copy Text to Clipboard
This feature allows you to copy a given string to the clipboard. The code sample demonstrates how to use the clipboard-copy package to copy the text 'Hello, World!' to the clipboard.
const copy = require('clipboard-copy');
copy('Hello, World!');
The clipboard-js package provides similar functionality to clipboard-copy, allowing you to copy text to the clipboard. It offers a more comprehensive API with additional features such as reading from the clipboard and handling clipboard events.
The copy-to-clipboard package is another alternative that provides a simple way to copy text to the clipboard. It is lightweight and easy to use, similar to clipboard-copy, but it also includes support for older browsers.
The clipboard-polyfill package offers a polyfill for the modern Clipboard API, providing a more robust solution for copying text to the clipboard. It supports both writing to and reading from the clipboard, making it a more versatile option compared to clipboard-copy.
The goal of this package is to offer simple copy-to-clipboard functionality in modern web browsers using the fewest bytes. To do so, this package only supports modern browsers. No fallback using Adobe Flash, no hacks. Just 30 lines of code.
Unlike other implementations, text copied with clipboard-copy
is clean and
unstyled. Copied text will not inherit HTML/CSS styling like the page's background
color.
Supported browsers: Chrome, Firefox, Edge, Safari.
Works in the browser with browserify!
npm install clipboard-copy
const copy = require('clipboard-copy')
button.addEventListener('click', function () {
copy('This is some cool text')
})
successPromise = copy(text)
Copy the given text to the user's clipboard. Returns successPromise
, a promise that resolves if the copy was successful and rejects if the copy failed.
Note: in most browsers, copying to the clipboard is only allowed if copy()
is
triggered in direct response to a user gesture like a 'click'
or a 'keypress'
.
clipboard-copy
(this package): 524 B gzippedclipboard-js
: 1.7 kB gzippedclipboard
: 3.2 kB gzippedTesting this module is currently a manual process. Open test.html
in your web browser and follow the short instructions. The web page will always load the latest version of the module, no bundling is necessary.
MIT. Copyright (c) Feross Aboukhadijeh.
FAQs
Lightweight copy to clipboard for the web
The npm package clipboard-copy receives a total of 273,217 weekly downloads. As such, clipboard-copy popularity was classified as popular.
We found that clipboard-copy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.