prefetchDNS
Resolves an origin's DNS ahead of use.
Resolves an origin's DNS ahead of use. Cheaper than preconnect; React's prefetchDNS.
Import#
ts
import { prefetchDNS } from "@shadow-js/web";
Signature#
ts
function prefetchDNS(href: string): void
Parameters#
| Name | Description |
|---|---|
href |
An http(s) origin or URL. |
Throws#
- TypeError (production message
SHADOW_RESOURCE_HINT_URL) for a URL that is not http(s) or relative.
Examples#
ts
import { prefetchDNS } from "@shadow-js/web";
prefetchDNS("https://api.example.com");