chrome_sys/
storage.rs

1use js_sys::Array;
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5extern "C" {
6
7    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="set")]
8    pub async fn set(data: JsValue) -> Result<JsValue, JsValue>;
9
10    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="get")]
11    pub async fn get(key: String) -> Result<JsValue, JsValue>;
12
13    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="get")]
14    pub async fn get_items(keys: Array) -> Result<JsValue, JsValue>;
15
16    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="get")]
17    pub async fn get_all() -> Result<JsValue, JsValue>;
18
19    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="remove")]
20    pub async fn remove(key: String) -> Result<(), JsValue>;
21
22    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="remove")]
23    pub async fn remove_items(keys: Array) -> Result<(), JsValue>;
24
25    #[wasm_bindgen(catch, js_namespace = ["chrome", "storage", "local"], js_name="clear")]
26    pub async fn clear() -> Result<(), JsValue>;
27
28}