create Signal::global

This commit is contained in:
Evan Almloff committed 2024-01-19 13:46:17 -06:00
1 parent 3dce650367
commit bc914deeaa
23 files changed
+324 -1105

No files matched your search

+5
View File
@@ -390,4 +390,9 @@ impl ScopeId {
pub fn height(self) -> u32 {
Runtime::with_scope(self, |cx| cx.height()).expect("to be in a dioxus runtime")
}
/// Run a closure inside of scope's runtime
pub fn in_runtime<T>(self, f: impl FnOnce() -> T) -> T {
Runtime::with_scope(self, |_| f()).expect("to be in a dioxus runtime")
}
}