Socket
Book a DemoInstallSign in
Socket

clipbrd

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipbrd

Lightweight copy to clipboard for modern browsers

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
55
-39.56%
Maintainers
1
Weekly downloads
 
Created
Source

clipbrd

NPM Package Minified Size License: MIT

Lightweight module to copy text to the clipboard in modern browsers (< 1kB minified)

Install

npm install clipbrd

Usage

import * as clipboard from 'clipbrd';

if (clipboard.isSupported()) {
    button.addEventListener('click', () => {
        clipboard.copy('Custom text');
    });
}

API

copy(text)

Copy text to the clipboard.

Returns a boolean of whether it succeeded.

Must be called in response to a user gesture event, like click or keyup.

isSupported()

Check if copy is supported, that way you can hide copy buttons from the UI.

Returns a boolean

Reference

License

MIT License

Keywords

clipboard

FAQs

Package last updated on 26 Jul 2018

Did you know?

Socket

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.

Install

Related posts