gloo_storage/
local_storage.rs

1use wasm_bindgen::UnwrapThrowExt;
2
3use crate::Storage;
4
5/// Provides API to deal with `localStorage`
6#[derive(Debug)]
7pub struct LocalStorage;
8
9impl Storage for LocalStorage {
10    fn raw() -> web_sys::Storage {
11        web_sys::window()
12            .expect_throw("no window")
13            .local_storage()
14            .expect_throw("failed to get local_storage")
15            .expect_throw("no local storage")
16    }
17}