Skip to main content

web_sys/features/
gen_Storage.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "::js_sys::Object",
9        js_name = "Storage",
10        typescript_type = "Storage"
11    )]
12    #[derive(Debug, Clone, PartialEq, Eq)]
13    #[doc = "The `Storage` class."]
14    #[doc = ""]
15    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage)"]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
18    pub type Storage;
19    #[wasm_bindgen(catch, method, getter, js_class = "Storage", js_name = "length")]
20    #[doc = "Getter for the `length` field of this object."]
21    #[doc = ""]
22    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/length)"]
23    #[doc = ""]
24    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
25    pub fn length(this: &Storage) -> Result<u32, JsValue>;
26    #[wasm_bindgen(catch, method, js_class = "Storage")]
27    #[doc = "The `clear()` method."]
28    #[doc = ""]
29    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/clear)"]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
32    pub fn clear(this: &Storage) -> Result<(), JsValue>;
33    #[wasm_bindgen(catch, method, js_class = "Storage", js_name = "getItem")]
34    #[doc = "The `getItem()` method."]
35    #[doc = ""]
36    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem)"]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
39    pub fn get_item(this: &Storage, key: &str) -> Result<Option<::alloc::string::String>, JsValue>;
40    #[wasm_bindgen(catch, method, js_class = "Storage")]
41    #[doc = "The `key()` method."]
42    #[doc = ""]
43    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/key)"]
44    #[doc = ""]
45    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
46    pub fn key(this: &Storage, index: u32) -> Result<Option<::alloc::string::String>, JsValue>;
47    #[wasm_bindgen(catch, method, js_class = "Storage", js_name = "removeItem")]
48    #[doc = "The `removeItem()` method."]
49    #[doc = ""]
50    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/removeItem)"]
51    #[doc = ""]
52    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
53    pub fn remove_item(this: &Storage, key: &str) -> Result<(), JsValue>;
54    #[wasm_bindgen(catch, method, js_class = "Storage", js_name = "setItem")]
55    #[doc = "The `setItem()` method."]
56    #[doc = ""]
57    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem)"]
58    #[doc = ""]
59    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
60    pub fn set_item(this: &Storage, key: &str, value: &str) -> Result<(), JsValue>;
61    #[wasm_bindgen(catch, method, js_class = "Storage", indexing_getter)]
62    #[doc = "Indexing getter. As in the literal Javascript `this[key]`."]
63    #[doc = ""]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
66    pub fn get(this: &Storage, key: &str) -> Result<Option<::alloc::string::String>, JsValue>;
67    #[wasm_bindgen(catch, method, js_class = "Storage", indexing_setter)]
68    #[doc = "Indexing setter. As in the literal Javascript `this[key] = value`."]
69    #[doc = ""]
70    #[doc = ""]
71    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
72    pub fn set(this: &Storage, key: &str, value: &str) -> Result<(), JsValue>;
73    #[wasm_bindgen(catch, method, js_class = "Storage", indexing_deleter)]
74    #[doc = "Indexing deleter. As in the literal Javascript `delete this[key]`."]
75    #[doc = ""]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `Storage`*"]
78    pub fn delete(this: &Storage, key: &str) -> Result<(), JsValue>;
79}