Documentation ¶
Overview ¶
Package preload defines representations of preload links.
Index ¶
Constants ¶
const ( AsAudio = "audio" AsDocument = "document" AsEmbed = "embed" AsFetch = "fetch" AsFont = "font" AsImage = "image" AsObject = "object" AsScript = "script" AsStyle = "style" AsTrack = "track" AsWorker = "worker" AsVideo = "video" )
Values for the "as" attribute of preload links.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preload ¶
type Preload struct { *httplink.Link // Resources contains a set of resources referenced by the preload link. // It typically consists just of one resource, but contains multiple // resources when the preload offers more than one option, such as images // with multi-source ("imagesrcset") or content negotiations ("variants"). Resources []*resource.Resource }
Preload represents a preload link.
func NewPreloadForLink ¶
NewPreloadForLink creates and initializes a new Preload to perform the preloading as specified by link. The new Preload is populated with a new single Resource requesting to link.URL. Note it implies link.URL should be absolute.
NewPreloadForLink assumes link.IsPreload() to be true.
func NewPreloadForResource ¶
NewPreloadForResource creates and initializes a new Preload to preload a single Resource.
as specifies the "as" parameter value. If it is empty, the parameter is kept unset.
func NewPreloadForURL ¶
NewPreloadForURL creates and initializes a new Preload to preload u. The new Preload is populated with a new single Resource requesting to u. Note it implies u should be absolute.
as specifies the "as" parameter value. If it is empty, the parameter is kept unset.
Directories ¶
Path | Synopsis |
---|---|
Package preloadtest provides utilities for preload link testing.
|
Package preloadtest provides utilities for preload link testing. |