Module inject

Source
Expand description

DOM injection utilities, allowing injection of script and style elements from Rust buffers using Blob objects.

This can be used in conjunction with include_bytes macro to embed JavaScript scripts, modules and CSS stylesheets directly within WASM binary.

Enums§

Content
The Content enum specifies the type of the content being injected Each enum variant contains optional content id and &[u8] data.

Functions§

inject_blob
Inject a Blob into DOM. The content argument carries the data buffer and the content type represented by the Content struct. This function returns a future that completes upon injection completion.
inject_blob_nowait
Inject a Blob into DOM. The content argument carries the data buffer and the content type represented by the Content struct.
inject_blob_with_callback
Inject data buffer contained in the Content struct as a Blob into DOM. Executes an optional load callback when the loading is complete. The load callback receives web_sys::CustomEvent struct indicating the load result.
inject_css
Inject CSS stylesheed directly into DOM as a <style> element using Element::set_inner_html
inject_script
Inject script as a Blob buffer into DOM. Executes an optional load callback when the loading is complete. The load callback receives web_sys::CustomEvent struct indicating the load result.
inject_stylesheet

Type Aliases§

CustomEventCallback