Change context api to panic with nice error message
This commit is contained in:
19 files changed
+96
-69
No files matched your search
@@ -33,7 +33,7 @@ use tao::platform::ios::WindowExtIOS;
|
||||
///
|
||||
/// This function will panic if it is called outside of the context of a Dioxus App.
|
||||
pub fn window() -> DesktopContext {
|
||||
dioxus_core::prelude::consume_context().unwrap()
|
||||
dioxus_core::prelude::consume_context()
|
||||
}
|
||||
|
||||
/// A handle to the [`DesktopService`] that can be passed around.
|
||||
|
||||
@@ -14,7 +14,7 @@ use wry::RequestAsyncResponder;
|
||||
|
||||
/// Get an imperative handle to the current window
|
||||
pub fn use_window() -> DesktopContext {
|
||||
use_hook(|| consume_context::<DesktopContext>()).unwrap()
|
||||
use_hook(|| consume_context::<DesktopContext>())
|
||||
}
|
||||
|
||||
/// Get a closure that executes any JavaScript in the WebView context.
|
||||
|
||||
Reference in new issue
Block a user