Implement editor level future message handler (#4182)

* Implement proper editor level async message handler

* Take application_io and wake callback as Editor::new arguments

* Rename AsyncMessage -> FutureMessage

* add DesktopWrapperMessage::Wake

---------

Co-authored-by: Timon <me@timon.zip>
This commit is contained in:
Dennis Kobert
2026-05-31 21:26:29 +00:00
committed by GitHub
co-authored by Timon
parent 51427bef5f
commit 78679a5ba2
22 changed files with 261 additions and 82 deletions
+11
View File
@@ -108,6 +108,17 @@ pub(crate) async fn poll_node_graph_evaluation() {
});
}
/// Web wake callback: queues a microtask that dispatches [`FutureMessage::Wake`].
#[cfg(all(not(feature = "native"), target_family = "wasm"))]
pub(crate) fn async_wake_callback() -> Wake {
use std::sync::Arc;
Arc::new(|| {
wasm_bindgen_futures::spawn_local(async {
wrapper(|wrapper| wrapper.dispatch(FutureMessage::Wake));
});
})
}
pub(crate) fn auto_save_all_documents() {
// Process no further messages after a crash to avoid spamming the console
if EDITOR_HAS_CRASHED.load(Ordering::SeqCst) {