misc
This commit is contained in:
@@ -43,9 +43,9 @@ cfg_if::cfg_if! {
|
||||
if #[cfg(target_arch = "wasm32")] {
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use lol_alloc::{FreeListAllocator, LockedAllocator};
|
||||
use lol_alloc::{FreeListAllocator, AssumeSingleThreaded};
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
|
||||
static ALLOCATOR: AssumeSingleThreaded<FreeListAllocator> = unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) };
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub async fn start() {
|
||||
|
||||
@@ -379,16 +379,16 @@ impl MathApp {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
tracing::info!("Saving function data");
|
||||
let hash: crate::misc::HashBytes = unsafe {
|
||||
std::mem::transmute::<&str, crate::misc::HashBytes>(build::SHORT_COMMIT)
|
||||
};
|
||||
let saved_data = &crate::misc::hashed_storage_create(
|
||||
&hash,
|
||||
bincode::serialize(&self.functions).unwrap().as_slice(),
|
||||
use crate::misc::{HashBytes, HashBytesHelper};
|
||||
let hash: HashBytes =
|
||||
unsafe { std::mem::transmute::<&str, HashBytes>(build::SHORT_COMMIT) };
|
||||
let saved_data = hash.hashed_storage_create(
|
||||
&bincode::serialize(&self.functions)
|
||||
.expect("unable to deserialize functions"),
|
||||
);
|
||||
// tracing::info!("Bytes: {}", saved_data.len());
|
||||
get_localstorage()
|
||||
.set_item(FUNC_NAME, saved_data)
|
||||
.set_item(FUNC_NAME, &saved_data)
|
||||
.expect("failed to set local function storage");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user