jj
    Preparing search index...

    Function addLinkPre

    • Adds a <link> tag to the document head for prefetching or preloading resources.

      Parameters

      • ...args: [
            href: string
            | URL,
            rel: "prefetch" | "preload",
            as?: "script" | "style" | "fetch",
        ]

        The arguments to be passed to createLinkPre.

      Returns JJHE<HTMLElement>

      The JJHE instance representing the link element.

      This function helps in optimizing performance by telling the browser to fetch resources that might be needed later (prefetch) or are needed immediately (preload).

      Please refer to createLinkPre for more details.

      // Preload a script
      addLinkPre('https://example.com/script.js', 'preload', 'script')

      // Prefetch a future page's CSS
      addLinkPre('/next-page.css', 'prefetch', 'style')

      If href is not a string or URL.

      If rel or as are not valid values.