Clipboard
A clipboard utility that handles copy/read operations, availability checks, and reactive copy state with error handling.
Example coming soon!
Usage
import { Clipboard } from 'svxui';
// Create a clipboard instance
const clipboard = new Clipboard();
// Copy to clipboard
const success = await clipboard.copy('text to clipboard');
// Read from clipboard
const textFromClipbord = await clipboard.read();Type Definition
Clipboard
export declare class Clipboard {
constructor(options?: ClipBoardOptions);
/**
* Indicates whether the Clipboard API is supported by the current environment.
*/
get isSupported(): any;
/**
* Indicates whether the clipboard can be used in the current context (e.g. secure context).
*/
get isAvailable(): any;
/**
* Indicates whether a copy operation is active.
* This state remains true for the configured copiedDuration.
*/
get isCopying(): any;
/**
* Contains the last clipboard error, if any.
*/
get error(): any;
/**
* Copy text to the clipboard
*/
copy(text: string): Promise<boolean>;
/**
* Read text from the clipboard
*/
read(): Promise<string | null>;
/**
* Reset error
*/
clearError(): void;
}ClipboardOptions
export type ClipBoardOptions = {
/**
* Time in milliseconds before the isCopying flag is cleared after a copy action.
*/
copyingDuration?: number;
};