Documentation
¶
Overview ¶
Package assets contains the embedded client assets and helpers used by JaWS setup code.
The embedded JavaScript applies server-sent DOM updates and intentionally trusts the server to distinguish trusted HTML from escaped user text. Applications should route untrusted text through escaping helpers before it reaches html/template.HTML or raw string HTML paths.
Index ¶
Constants ¶
const ISO8601 = "2006-01-02"
ISO8601 is the date format used by date input widgets (YYYY-MM-DD).
Variables ¶
var DefaultCookieName string
DefaultCookieName is the default JaWS cookie name, derived from the executable's base name (ASCII letters and digits only) and falling back to "jaws". It is computed once during package initialization, so it is safe to read concurrently; callers needing a different name supply their own.
var JavascriptText string
JavascriptText is the source code for the client-side JaWS JavaScript library.
It holds the embedded asset as an immutable string shared process-wide.
var JawsCSS string
JawsCSS is the source code for the client-side JaWS stylesheet.
It holds the embedded asset as an immutable string shared process-wide.
Functions ¶
func MakeCookieName ¶
MakeCookieName creates a cookie-safe name from an executable path.
It uses the path's base name with its last file extension removed, then keeps only ASCII letters and digits. If no usable characters remain (including for an empty path), it returns "jaws", the fallback recorded in DefaultCookieName.
func PreloadHTML ¶
PreloadHTML returns HTML code to load the given resources efficiently.
JavaScript and CSS files are emitted as script and stylesheet tags. Other recognized resources are emitted as preload tags. Favicon image URLs are returned separately.
Nil URL arguments are skipped. A resource is returned as faviconURL only when its base name begins with "favicon" and its MIME type (resolved from the file extension) is image/*; a favicon whose extension has no image MIME mapping is emitted as an ordinary preload link instead. A .js or .css resource is always emitted as a script or stylesheet and is never treated as a favicon, regardless of its base name. If more than one resource qualifies as a favicon, the last one wins and earlier favicon URLs are discarded rather than emitted as preload links.
Types ¶
This section is empty.