wip: changes to scheduler

This commit is contained in:
Jonathan Kelley committed 2021-09-22 01:25:28 -04:00
1 parent b32e2611e3
commit 098d3821ed
14 files changed
+151 -282

No files matched your search

+3 -2
View File
@@ -61,6 +61,7 @@ use dioxus::prelude::Properties;
use dioxus::virtual_dom::VirtualDom;
pub use dioxus_core as dioxus;
use dioxus_core::prelude::FC;
use futures_util::FutureExt;
mod cache;
mod cfg;
@@ -145,10 +146,10 @@ pub async fn run_with_props<T: Properties + 'static>(root: FC<T>, root_props: T,
dom.wait_for_work().await;
// wait for the mainthread to schedule us in
let deadline = work_loop.wait_for_idle_time().await;
let mut deadline = work_loop.wait_for_idle_time().await;
// run the virtualdom work phase until the frame deadline is reached
let mutations = dom.run_with_deadline(deadline).await;
let mutations = dom.run_with_deadline(|| (&mut deadline).now_or_never().is_some());
// wait for the animation frame to fire so we can apply our changes
work_loop.wait_for_raf().await;
+3 -1
View File
@@ -33,8 +33,10 @@ impl RafLoop {
.call0(&JsValue::NULL)
.unwrap();
let window = web_sys::window().unwrap();
Self {
window: web_sys::window().unwrap(),
window,
raf_receiver,
raf_closure,
ric_receiver,