Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 739 Bytes

File metadata and controls

40 lines (30 loc) · 739 Bytes

@nativescript-use/nativescript-clipboard

npm install @nativescript-use/nativescript-clipboard

Usage

import { Clipboard } from "@nativescript-use/nativescript-clipboard"

const clipboard = new Clipboard();

// Copy text
clipboard.copy("My text");

// Read Clipboard
const currentClipboardValue = clipboard.read();

// Add listener
clipboard.onCopy((textCopied: string) =>{
  console.log(textCopied)
});
// Remove listener
clipboard.offCopy();

Type declaration

export declare class Clipboard {
    abstract onCopy(callback: (text: string) => void): void
    abstract offCopy(): void
    abstract copy(text: string): boolean
    abstract read(): string
}

License

Apache License Version 2.0