Pull out asset handler refactor from https://github.com/DioxusLabs/dioxus/pull/2972 (#3000)
This commit is contained in:
1 parent
95976d9a17
commit
f9c2f740c2
4 files changed
+15
-28
No files matched your search
@@ -5,7 +5,7 @@ use crate::{
|
||||
ShortcutHandle, ShortcutRegistryError, WryEventHandler,
|
||||
};
|
||||
use dioxus_core::{
|
||||
prelude::{consume_context, current_scope_id, use_hook_with_cleanup, RuntimeGuard},
|
||||
prelude::{consume_context, use_hook_with_cleanup, RuntimeGuard},
|
||||
use_hook, Runtime,
|
||||
};
|
||||
|
||||
@@ -69,11 +69,9 @@ pub fn use_asset_handler(
|
||||
|
||||
use_hook_with_cleanup(
|
||||
|| {
|
||||
crate::window().asset_handlers.register_handler(
|
||||
name.to_string(),
|
||||
Box::new(move |asset, responder| cb((asset, responder))),
|
||||
current_scope_id().unwrap(),
|
||||
);
|
||||
crate::window()
|
||||
.asset_handlers
|
||||
.register_handler(name.to_string(), cb);
|
||||
|
||||
Rc::new(name.to_string())
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user