Chartbreaker
    Preparing search index...

    Interface Clipboard

    The Clipboard interface of the Clipboard API provides read and write access to the contents of the system clipboard. This allows a web application to implement cut, copy, and paste features. Available only in secure contexts.

    MDN Reference

    interface Clipboard {
        addEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | AddEventListenerOptions,
        ): void;
        dispatchEvent(event: Event): boolean;
        read(): Promise<ClipboardItems>;
        readText(): Promise<string>;
        removeEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | EventListenerOptions,
        ): void;
        write(data: ClipboardItems): Promise<void>;
        writeText(data: string): Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The read() method of the Clipboard interface requests a copy of the clipboard's contents, fulfilling the returned Promise with the data.

      MDN Reference

      Returns Promise<ClipboardItems>

    • The readText() method of the Clipboard interface returns a Promise which fulfills with a copy of the textual contents of the system clipboard.

      MDN Reference

      Returns Promise<string>

    • The write() method of the Clipboard interface writes arbitrary ClipboardItem data such as images and text to the clipboard, fulfilling the returned Promise on completion. This can be used to implement cut and copy functionality.

      MDN Reference

      Parameters

      Returns Promise<void>

    • The writeText() method of the Clipboard interface writes the specified text to the system clipboard, returning a Promise that is resolved once the system clipboard has been updated.

      MDN Reference

      Parameters

      • data: string

      Returns Promise<void>