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