web_sys/features/
gen_FileReader.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = FileReader , typescript_type = "FileReader")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `FileReader` class."]
10    #[doc = ""]
11    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader)"]
12    #[doc = ""]
13    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
14    pub type FileReader;
15    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = readyState)]
16    #[doc = "Getter for the `readyState` field of this object."]
17    #[doc = ""]
18    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readyState)"]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
21    pub fn ready_state(this: &FileReader) -> u16;
22    # [wasm_bindgen (structural , catch , method , getter , js_class = "FileReader" , js_name = result)]
23    #[doc = "Getter for the `result` field of this object."]
24    #[doc = ""]
25    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result)"]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
28    pub fn result(this: &FileReader) -> Result<::wasm_bindgen::JsValue, JsValue>;
29    #[cfg(feature = "DomException")]
30    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = error)]
31    #[doc = "Getter for the `error` field of this object."]
32    #[doc = ""]
33    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/error)"]
34    #[doc = ""]
35    #[doc = "*This API requires the following crate features to be activated: `DomException`, `FileReader`*"]
36    pub fn error(this: &FileReader) -> Option<DomException>;
37    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onloadstart)]
38    #[doc = "Getter for the `onloadstart` field of this object."]
39    #[doc = ""]
40    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onloadstart)"]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
43    pub fn onloadstart(this: &FileReader) -> Option<::js_sys::Function>;
44    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onloadstart)]
45    #[doc = "Setter for the `onloadstart` field of this object."]
46    #[doc = ""]
47    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onloadstart)"]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
50    pub fn set_onloadstart(this: &FileReader, value: Option<&::js_sys::Function>);
51    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onprogress)]
52    #[doc = "Getter for the `onprogress` field of this object."]
53    #[doc = ""]
54    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onprogress)"]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
57    pub fn onprogress(this: &FileReader) -> Option<::js_sys::Function>;
58    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onprogress)]
59    #[doc = "Setter for the `onprogress` field of this object."]
60    #[doc = ""]
61    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onprogress)"]
62    #[doc = ""]
63    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
64    pub fn set_onprogress(this: &FileReader, value: Option<&::js_sys::Function>);
65    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onload)]
66    #[doc = "Getter for the `onload` field of this object."]
67    #[doc = ""]
68    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onload)"]
69    #[doc = ""]
70    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
71    pub fn onload(this: &FileReader) -> Option<::js_sys::Function>;
72    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onload)]
73    #[doc = "Setter for the `onload` field of this object."]
74    #[doc = ""]
75    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onload)"]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
78    pub fn set_onload(this: &FileReader, value: Option<&::js_sys::Function>);
79    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onabort)]
80    #[doc = "Getter for the `onabort` field of this object."]
81    #[doc = ""]
82    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onabort)"]
83    #[doc = ""]
84    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
85    pub fn onabort(this: &FileReader) -> Option<::js_sys::Function>;
86    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onabort)]
87    #[doc = "Setter for the `onabort` field of this object."]
88    #[doc = ""]
89    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onabort)"]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
92    pub fn set_onabort(this: &FileReader, value: Option<&::js_sys::Function>);
93    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onerror)]
94    #[doc = "Getter for the `onerror` field of this object."]
95    #[doc = ""]
96    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onerror)"]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
99    pub fn onerror(this: &FileReader) -> Option<::js_sys::Function>;
100    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onerror)]
101    #[doc = "Setter for the `onerror` field of this object."]
102    #[doc = ""]
103    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onerror)"]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
106    pub fn set_onerror(this: &FileReader, value: Option<&::js_sys::Function>);
107    # [wasm_bindgen (structural , method , getter , js_class = "FileReader" , js_name = onloadend)]
108    #[doc = "Getter for the `onloadend` field of this object."]
109    #[doc = ""]
110    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onloadend)"]
111    #[doc = ""]
112    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
113    pub fn onloadend(this: &FileReader) -> Option<::js_sys::Function>;
114    # [wasm_bindgen (structural , method , setter , js_class = "FileReader" , js_name = onloadend)]
115    #[doc = "Setter for the `onloadend` field of this object."]
116    #[doc = ""]
117    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onloadend)"]
118    #[doc = ""]
119    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
120    pub fn set_onloadend(this: &FileReader, value: Option<&::js_sys::Function>);
121    #[wasm_bindgen(catch, constructor, js_class = "FileReader")]
122    #[doc = "The `new FileReader(..)` constructor, creating a new instance of `FileReader`."]
123    #[doc = ""]
124    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/FileReader)"]
125    #[doc = ""]
126    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
127    pub fn new() -> Result<FileReader, JsValue>;
128    # [wasm_bindgen (method , structural , js_class = "FileReader" , js_name = abort)]
129    #[doc = "The `abort()` method."]
130    #[doc = ""]
131    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/abort)"]
132    #[doc = ""]
133    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
134    pub fn abort(this: &FileReader);
135    #[cfg(feature = "Blob")]
136    # [wasm_bindgen (catch , method , structural , js_class = "FileReader" , js_name = readAsArrayBuffer)]
137    #[doc = "The `readAsArrayBuffer()` method."]
138    #[doc = ""]
139    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer)"]
140    #[doc = ""]
141    #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReader`*"]
142    pub fn read_as_array_buffer(this: &FileReader, blob: &Blob) -> Result<(), JsValue>;
143    #[cfg(feature = "Blob")]
144    # [wasm_bindgen (catch , method , structural , js_class = "FileReader" , js_name = readAsBinaryString)]
145    #[doc = "The `readAsBinaryString()` method."]
146    #[doc = ""]
147    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsBinaryString)"]
148    #[doc = ""]
149    #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReader`*"]
150    pub fn read_as_binary_string(this: &FileReader, filedata: &Blob) -> Result<(), JsValue>;
151    #[cfg(feature = "Blob")]
152    # [wasm_bindgen (catch , method , structural , js_class = "FileReader" , js_name = readAsDataURL)]
153    #[doc = "The `readAsDataURL()` method."]
154    #[doc = ""]
155    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL)"]
156    #[doc = ""]
157    #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReader`*"]
158    pub fn read_as_data_url(this: &FileReader, blob: &Blob) -> Result<(), JsValue>;
159    #[cfg(feature = "Blob")]
160    # [wasm_bindgen (catch , method , structural , js_class = "FileReader" , js_name = readAsText)]
161    #[doc = "The `readAsText()` method."]
162    #[doc = ""]
163    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsText)"]
164    #[doc = ""]
165    #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReader`*"]
166    pub fn read_as_text(this: &FileReader, blob: &Blob) -> Result<(), JsValue>;
167    #[cfg(feature = "Blob")]
168    # [wasm_bindgen (catch , method , structural , js_class = "FileReader" , js_name = readAsText)]
169    #[doc = "The `readAsText()` method."]
170    #[doc = ""]
171    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsText)"]
172    #[doc = ""]
173    #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileReader`*"]
174    pub fn read_as_text_with_label(
175        this: &FileReader,
176        blob: &Blob,
177        label: &str,
178    ) -> Result<(), JsValue>;
179}
180impl FileReader {
181    #[doc = "The `FileReader.EMPTY` const."]
182    #[doc = ""]
183    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
184    pub const EMPTY: u16 = 0i64 as u16;
185    #[doc = "The `FileReader.LOADING` const."]
186    #[doc = ""]
187    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
188    pub const LOADING: u16 = 1u64 as u16;
189    #[doc = "The `FileReader.DONE` const."]
190    #[doc = ""]
191    #[doc = "*This API requires the following crate features to be activated: `FileReader`*"]
192    pub const DONE: u16 = 2u64 as u16;
193}