mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 02:18:12 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user