as

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Audio Audio resource for media playback. Browser prioritizes and applies audio-specific
	// optimizations and content security policies for music, sound effects, or podcasts.
	Audio = As("audio")

	// Document HTML document resource for navigation or embedding. Browser applies document parsing
	// and security policies for iframe content or navigation targets.
	Document = As("document")

	// Embed Resource for embedding via object or embed elements. Browser applies appropriate
	// security policies and loading strategies for plugin or embedded content.
	Embed = As("embed")

	// Fetch Resource for JavaScript fetch() or XHR requests. Generic type for API responses,
	// JSON data, or other programmatically loaded content.
	Fetch = As("fetch")

	// Font Font resource for text rendering. Browser applies font loading optimizations
	// and CORS policies for web fonts and typography resources.
	Font = As("font")

	// Image Image resource for visual content. Browser applies image-specific optimizations,
	// decoding strategies, and security policies for graphics and photos.
	Image = As("image")

	// Object Resource for object elements including plugins, embedded media, or interactive content.
	// Browser applies object-specific loading and security policies.
	Object = As("object")

	// Script JavaScript resource for code execution. Browser applies script loading optimizations,
	// CSP policies, and execution strategies for performance and security.
	Script = As("script")

	// Style CSS stylesheet resource for visual presentation. Browser prioritizes style loading
	// to prevent layout shifts and applies CSS-specific parsing optimizations.
	Style = As("style")

	// Track Text track resource for media captions, subtitles, or descriptions. Browser applies
	// track-specific loading for accessibility and media synchronization.
	Track = As("track")

	// Video Video resource for media playback. Browser applies video-specific optimizations,
	// buffering strategies, and security policies for motion picture content.
	Video = As("video")

	// Worker Web Worker script for background processing. Browser applies worker-specific loading
	// and execution policies for multithreaded JavaScript applications.
	Worker = As("worker")
)

Variables for As values

Functions

This section is empty.

Types

type As

type As []byte

As Resource type hint for preload links. Required with rel="preload" to specify content type for proper prioritization, parsing, and CSP application by the browser.

func Custom

func Custom(value string) As

Custom allows setting a custom As value for edge cases or future specifications. Use this when the predefined constants don't cover your specific use case.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL