use dioxus_document::*;
use dioxus_web::WebDocument;
fn head_element_written_on_server() -> bool {
dioxus_fullstack_protocol::head_element_hydration_entry()
.get()
.ok()
.unwrap_or_default()
}
#[derive(Clone)]
pub struct FullstackWebDocument;
impl Document for FullstackWebDocument {
fn eval(&self, js: String) -> Eval {
WebDocument.eval(js)
}
fn set_title(&self, title: String) {
WebDocument.set_title(title);
}
fn create_meta(&self, props: MetaProps) {
WebDocument.create_meta(props);
}
fn create_script(&self, props: ScriptProps) {
WebDocument.create_script(props);
}
fn create_style(&self, props: StyleProps) {
WebDocument.create_style(props);
}
fn create_link(&self, props: LinkProps) {
WebDocument.create_link(props);
}
fn create_head_component(&self) -> bool {
!head_element_written_on_server()
}
}