wip: websys dom working properly
This commit is contained in:
1 parent
d717c22d9c
commit
cfa0247cbb
9 files changed
+200
-97
No files matched your search
@@ -45,7 +45,7 @@ pub struct SharedResources {
|
||||
|
||||
pub(crate) heuristics: Shared<HeuristicsEngine>,
|
||||
|
||||
pub(crate) tasks: Shared<FuturesUnordered<FiberTask>>,
|
||||
pub tasks: Shared<FuturesUnordered<FiberTask>>,
|
||||
|
||||
/// We use a SlotSet to keep track of the keys that are currently being used.
|
||||
/// However, we don't store any specific data since the "mirror"
|
||||
|
||||
@@ -526,7 +526,8 @@ impl<'real, 'bump> DiffMachine<'real, 'bump> {
|
||||
let mut is_static = true;
|
||||
let mut added_to_stack = 0;
|
||||
|
||||
for child in children {
|
||||
// add them backwards
|
||||
for child in children.iter().rev() {
|
||||
let child_meta = self.create_vnode(child);
|
||||
is_static = is_static && child_meta.is_static;
|
||||
added_to_stack += child_meta.added_to_stack;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
//! This module includes just the barebones for a complete VirtualDOM API.
|
||||
//! Additional functionality is defined in the respective files.
|
||||
|
||||
use futures_util::StreamExt;
|
||||
|
||||
use crate::hooks::{SuspendedContext, SuspenseHook};
|
||||
use crate::{arena::SharedResources, innerlude::*};
|
||||
|
||||
@@ -400,6 +402,20 @@ impl VirtualDom {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn wait_for_event(&mut self) -> Option<EventTrigger> {
|
||||
let r = self.shared.tasks.clone();
|
||||
let mut r = r.borrow_mut();
|
||||
let gh = r.next().await;
|
||||
|
||||
gh
|
||||
}
|
||||
|
||||
pub fn any_pending_events(&self) -> bool {
|
||||
let r = self.shared.tasks.clone();
|
||||
let r = r.borrow();
|
||||
!r.is_empty()
|
||||
}
|
||||
|
||||
pub fn base_scope(&self) -> &Scope {
|
||||
unsafe { self.shared.get_scope(self.base_scope).unwrap() }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user