Skip to main content

Module loader

Module loader 

Source
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§

ContentStatus
Outcome of attempting to load a Content entry.
ContentType
The kind of resource a Content entry holds.
Reference
The kind of dependency one Content entry declares on another, determining how the reference is emitted into the generated source.

Functions§

context
Return the global, lazily-initialized loader Context singleton.
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§

ContentList
Borrowed slice of (id, content) pairs used to declare content entries.
ContentMap
Map of content entries keyed by their Id.
Id
Unique identifier of a Content entry within a Context.