clipboard-copy

WebJar for clipboard-copy

Лицензия

Лицензия

MIT
Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

clipboard-copy
Последняя версия

Последняя версия

3.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

clipboard-copy
WebJar for clipboard-copy
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/feross/clipboard-copy

Скачать clipboard-copy

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/clipboard-copy/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>clipboard-copy</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/clipboard-copy/
implementation 'org.webjars.npm:clipboard-copy:3.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/clipboard-copy/
implementation ("org.webjars.npm:clipboard-copy:3.0.0")
'org.webjars.npm:clipboard-copy:jar:3.0.0'
<dependency org="org.webjars.npm" name="clipboard-copy" rev="3.0.0">
  <artifact name="clipboard-copy" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='clipboard-copy', version='3.0.0')
)
libraryDependencies += "org.webjars.npm" % "clipboard-copy" % "3.0.0"
[org.webjars.npm/clipboard-copy "3.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

clipboard-copy travis npm downloads size javascript style guide

Lightweight copy to clipboard for the web

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!

install

npm install clipboard-copy

usage

const copy = require('clipboard-copy')

button.addEventListener('click', function () {
  copy('This is some cool text')
})

API

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'.

comparison to alternatives

testing

Testing 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.

license

MIT. Copyright (c) Feross Aboukhadijeh.

Версии библиотеки

Версия
3.0.0