0.9.1 • Published 4 years ago
text-copier v0.9.1
Simple clipboard function, written in TypeScript.
Installation
npm install --save text-copierUsage
import { copyText } from 'text-copier';
// When user clicks on a button,
// trigger the function
async function onClick() {
await copyText('Hello World');
alert('Copied to clipboard');
}Error Handling
import { copyText, Clipboard } from 'text-copier';
async function onClick() {
try {
await copyText('Hello World');
alert('Copied to clipboard');
} catch(event: Clipboard.Event) {
console.error(event);
}
}0.9.1
4 years ago