1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Implement Storage trait for egui_web:s local storage bindings

This commit is contained in:
Emil Ernerfeldt
2020-12-19 14:58:00 +01:00
parent 7ff5d4726b
commit 99808d2df8
3 changed files with 19 additions and 5 deletions

View File

@@ -172,6 +172,20 @@ pub fn save_memory(ctx: &egui::Context) {
}
}
pub struct LocalStorage {}
impl egui::app::Storage for LocalStorage {
fn get_string(&self, key: &str) -> Option<String> {
local_storage_get(key)
}
fn set_string(&mut self, key: &str, value: String) {
local_storage_set(key, &value);
}
fn flush(&mut self) {}
}
// ----------------------------------------------------------------------------
pub fn handle_output(output: &egui::Output) {
let egui::Output {
cursor_icon,