More cleaning up of the desktop crate

This commit is contained in:
Jonathan Kelley committed 2024-01-04 17:28:54 -08:00
1 parent 6e08703c6c
commit d47e494786
4 files changed
+39 -50

No files matched your search

+15 -1
View File
@@ -5,8 +5,8 @@ use crate::Config;
use crate::{assets::AssetFuture, edits::WebviewQueue};
use crate::{assets::AssetHandlerRegistry, edits::EditQueue};
use crate::{events::IpcMessage, webview::WebviewHandler};
use dioxus_core::ScopeState;
use dioxus_core::VirtualDom;
use dioxus_core::{Mutations, ScopeState};
use dioxus_interpreter_js::binary_protocol::Channel;
use rustc_hash::FxHashMap;
use slab::Slab;
@@ -121,6 +121,20 @@ impl DesktopService {
}
}
/// Send a list of mutations to the webview
pub(crate) fn send_edits(&self, edits: Mutations) {
let mut channel = self.channel.borrow_mut();
let mut templates = self.templates.borrow_mut();
if let Some(bytes) = crate::edits::apply_edits(
edits,
&mut channel,
&mut templates,
&self.max_template_count,
) {
self.edit_queue.add_edits(bytes)
}
}
/// Create a new window using the props and window builder
///
/// Returns the webview handle for the new window.