pub trait Document: 'static {
    // Required method
    fn eval(&self, js: String) -> Eval;
    // Provided methods
    fn set_title(&self, title: String) { ... }
    fn create_head_element(
        &self,
        name: &str,
        attributes: &[(&str, String)],
        contents: Option<String>,
    ) { ... }
    fn create_meta(&self, props: MetaProps) { ... }
    fn create_script(&self, props: ScriptProps) { ... }
    fn create_style(&self, props: StyleProps) { ... }
    fn create_link(&self, props: LinkProps) { ... }
}Expand description
A provider for document-related functionality.
Provides things like a history API, a title, a way to run JS, and some other basics/essentials used by nearly every platform.
An integration with some kind of navigation history.
Depending on your use case, your implementation may deviate from the described procedure. This
is fine, as long as both current_route and current_query match the described format.
However, you should document all deviations. Also, make sure the navigation is user-friendly. The described behaviors are designed to mimic a web browser, which most users should already know. Deviations might confuse them.
Required Methods§
Provided Methods§
Sourcefn create_head_element(
    &self,
    name: &str,
    attributes: &[(&str, String)],
    contents: Option<String>,
)
 
fn create_head_element( &self, name: &str, attributes: &[(&str, String)], contents: Option<String>, )
Create a new element in the head
Sourcefn create_meta(&self, props: MetaProps)
 
fn create_meta(&self, props: MetaProps)
Create a new meta tag in the head
Sourcefn create_script(&self, props: ScriptProps)
 
fn create_script(&self, props: ScriptProps)
Create a new script tag in the head
Sourcefn create_style(&self, props: StyleProps)
 
fn create_style(&self, props: StyleProps)
Create a new style tag in the head
Sourcefn create_link(&self, props: LinkProps)
 
fn create_link(&self, props: LinkProps)
Create a new link tag in the head