Tweakr
    Preparing search index...

    Function copyToClipboard

    • Copies a string to the clipboard.

      Uses navigator.clipboard if available, otherwise falls back to a hidden textarea. Returns true if the operation succeeds, false otherwise.

      Parameters

      • text: string

        Text to copy to clipboard.

      Returns Promise<boolean>

      true if successful, false otherwise.

      await copyToClipboard("Hello, world!");
      

      1.2.0