@advanced-rest-client/clipboard-copy
TypeScript icon, indicating that this package has built-in type declarations

3.1.1 • Public • Published

clipboard-copy

An element that copies a text to clipboard.

Published on NPM

Tests and publishing

Usage

Installation

npm install --save @advanced-rest-client/clipboard-copy

In an html file

<script type="module" src="/node_modules/@advanced-rest-client/clipboard-copy/clipboard-copy.js"></script>
<clipboard-copy content="test"></clipboard-copy>
<script>
const elm = document.querySelector('clipboard-copy');
if(elm.copy()) {
 console.info('Content has been copied to the clipboard');
} else {
 console.error('Content copy error. This browser is ancient!');
}
</script>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/clipboard-copy/clipboard-copy.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <clipboard-copy .content="${this.copyContent}"></clipboard-copy>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/clipboard-copy
cd clipboard-copy
npm install

Running the demo locally

npm start

Running the tests

npm test

Package Sidebar

Install

npm i @advanced-rest-client/clipboard-copy

Weekly Downloads

537

Version

3.1.1

License

Apache-2.0

Unpacked Size

38.6 kB

Total Files

10

Last publish

Collaborators

  • jarrodek
  • twoplustwoone
  • lbauret
  • carowright