1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

[egui_web] Repaint on finished fetch in example app

This commit is contained in:
Emil Ernerfeldt
2020-11-20 20:35:16 +01:00
parent 99a2a52510
commit 633b19ee99
8 changed files with 129 additions and 71 deletions

View File

@@ -36,6 +36,8 @@ pub struct IntegrationContext<'a> {
pub tex_allocator: Option<&'a mut dyn TextureAllocator>,
/// Where the app can issue commands back to the integration.
pub output: AppOutput,
/// If you need to request a repaint from another thread, clone this and give to that other thread
pub repaint_signal: std::sync::Arc<dyn RepaintSignal>,
}
#[derive(Clone, Debug)]
@@ -92,6 +94,12 @@ pub trait TextureAllocator {
fn free(&mut self, id: crate::TextureId);
}
pub trait RepaintSignal: Send {
/// This signals the Egui integration that a repaint is required.
/// This is meant to be called when a background process finishes in an async context and/or background thread.
fn request_repaint(&self);
}
/// A place where you can store custom data in a way that persists when you restart the app.
///
/// On the web this is backed by [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).