wip: websys dom working properly

This commit is contained in:
Jonathan Kelley committed 2021-07-30 17:04:04 -04:00
1 parent d717c22d9c
commit cfa0247cbb
9 files changed
+200 -97

No files matched your search

+16
View File
@@ -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() }
}