fix target wasm cfg

This commit is contained in:
Simon Gardling 2025-12-05 23:48:33 -05:00
parent 65ab0c6a1f
commit e497987573
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -173,11 +173,11 @@ impl MathApp {
.read_to_end(&mut data) .read_to_end(&mut data)
.expect("unable to read compressed data"); .expect("unable to read compressed data");
#[cfg(target = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {
tracing::info!("Setting decompression cache"); tracing::info!("Setting decompression cache");
let saved_data = hashed_storage_create(data); let saved_data = crate::misc::hashed_storage_create(&data);
tracing::info!("Bytes: {}", saved_data.len()); tracing::info!("Bytes: {}", saved_data.len());
get_localstorage() get_localstorage()
.set_item(DATA_NAME, saved_data) .set_item(DATA_NAME, saved_data)
@ -192,7 +192,7 @@ impl MathApp {
// Initialize fonts // Initialize fonts
// This used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug // This used to be in the `update` method, but (after a ton of digging) this actually caused OOMs. that was a pain to debug
cc.egui_ctx.set_fonts({ cc.egui_ctx.set_fonts({
#[cfg(target = "wasm32")] #[cfg(target_arch = "wasm32")]
if let Some(Ok(data)) = if let Some(Ok(data)) =
get_storage_decompressed().map(|data| bincode::deserialize(data.as_slice())) get_storage_decompressed().map(|data| bincode::deserialize(data.as_slice()))
{ {
@ -201,7 +201,7 @@ impl MathApp {
decompress_fonts() decompress_fonts()
} }
#[cfg(not(target = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
decompress_fonts() decompress_fonts()
}); });