PreloadOptions
Options of preload: the destination is required, as the browser needs it to pick the right request.
Options of preload: the destination is required, as the browser needs it to pick the right request.
Import#
ts
import type { PreloadOptions } from "@shadow-js/web";
Signature#
ts
interface PreloadOptions extends CrossOriginOptions {
/**
* The destination of the request, which the browser uses to pick its priority and headers. It
* must match how the resource is used later, or the preloaded copy is not reused.
*/
readonly as:
| "audio"
| "document"
| "embed"
| "fetch"
| "font"
| "image"
| "object"
| "script"
| "style"
| "track"
| "video"
| "worker";
/**
* MIME type, so the browser can skip unsupported formats (for example `font/woff2`).
* @default undefined (no `type` attribute)
*/
readonly type?: string;
/**
* Media query the hint applies to (for example `(min-width: 800px)`); the browser skips the
* preload when it does not match.
* @default undefined (no `media` attribute; the hint always applies)
*/
readonly media?: string;
}
Members#
| Name | Type | Description |
|---|---|---|
as |
readonly as: | "audio" | "document" | "embed" | "fetch" | "font" | "image" | "object" | "script" | "style" | "track" | "video" | "worker" |
The destination of the request, which the browser uses to pick its priority and headers. It must match how the resource is used later, or the preloaded copy is not reused. |
type? |
readonly type?: string |
MIME type, so the browser can skip unsupported formats (for example font/woff2). |
media? |
readonly media?: string |
Media query the hint applies to (for example (min-width: 800px)); the browser skips the preload when it does not match. |