import { DaffSsrHeaderLinkAssetPreloader } from '@daffodil/ssr'
Adds headers to the response that will preload the specified assets. Very useful for optimizing initial page load.
@Injectable()
class DaffSsrHeaderLinkAssetPreloader {
addHeader(
uri: string
kind: DaffSsrHeadersLinkPreloadAssetKind
priority: DaffSsrHeadersLinkPreloadAssetPriority
extra: Record<string, string> = {}
): void
}
voidAdds a link preload header to the SSR response.
| Parameter | uri: string |
|---|---|
| Description | The URI of the asset to preload. Take care that this is percent-encoded. @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link#encoding_urls |
| Parameter | kind: DaffSsrHeadersLinkPreloadAssetKind |
|---|---|
| Description |
| Parameter | priority: DaffSsrHeadersLinkPreloadAssetPriority |
|---|---|
| Description |
| Parameter | extra: Record |
|---|---|
| Default | {} |
| Description | Any extra values to add to the header. The key is the name of the param, the value is the value. |