Expand description
Runtime loader for injecting JavaScript modules, scripts and CSS stylesheets into the DOM and resolving dependencies between them.
Structs§
- Content
- A single loadable DOM resource (JavaScript module, script or CSS stylesheet) together with its identity, embedded source and the other content entries it references.
- Context
- Registry and loading context for DOM content, tracking declared content entries, de-duplicating in-flight load requests and counting loaded items.
Enums§
- Content
Status - Outcome of attempting to load a
Contententry. - Content
Type - The kind of resource a
Contententry holds. - Reference
- The kind of dependency one
Contententry declares on another, determining how the reference is emitted into the generated source.
Functions§
- context
- Return the global, lazily-initialized loader
Contextsingleton. - declare
- Declare the given content entries on the global loader
Context, registering them for subsequent loading, and return that context. - document
- Return the current browser
web_sys::Document. - root
- Return (lazily caching) the root element into which content is injected,
preferring the document
<head>and falling back to<body>.
Type Aliases§
- Content
List - Borrowed slice of
(id, content)pairs used to declare content entries. - Content
Map - Map of content entries keyed by their
Id. - Id
- Unique identifier of a
Contententry within aContext.