Skip to main content

web_sys/features/
gen_Notification.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 = "EventTarget",
9        extends = "::js_sys::Object",
10        js_name = "Notification",
11        typescript_type = "Notification"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `Notification` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
19    pub type Notification;
20    #[cfg(feature = "NotificationPermission")]
21    #[wasm_bindgen(
22        static_method_of = "Notification",
23        getter,
24        js_class = "Notification",
25        js_name = "permission"
26    )]
27    #[doc = "Getter for the `permission` field of this object."]
28    #[doc = ""]
29    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission)"]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationPermission`*"]
32    pub fn permission() -> NotificationPermission;
33    #[wasm_bindgen(
34        static_method_of = "Notification",
35        getter,
36        js_class = "Notification",
37        js_name = "maxActions"
38    )]
39    #[doc = "Getter for the `maxActions` field of this object."]
40    #[doc = ""]
41    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/maxActions)"]
42    #[doc = ""]
43    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
44    pub fn max_actions() -> u32;
45    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "onclick")]
46    #[doc = "Getter for the `onclick` field of this object."]
47    #[doc = ""]
48    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclick)"]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
51    pub fn onclick(this: &Notification) -> Option<::js_sys::Function>;
52    #[wasm_bindgen(method, setter, js_class = "Notification", js_name = "onclick")]
53    #[doc = "Setter for the `onclick` field of this object."]
54    #[doc = ""]
55    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclick)"]
56    #[doc = ""]
57    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
58    pub fn set_onclick(this: &Notification, value: Option<&::js_sys::Function>);
59    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "onshow")]
60    #[doc = "Getter for the `onshow` field of this object."]
61    #[doc = ""]
62    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onshow)"]
63    #[doc = ""]
64    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
65    pub fn onshow(this: &Notification) -> Option<::js_sys::Function>;
66    #[wasm_bindgen(method, setter, js_class = "Notification", js_name = "onshow")]
67    #[doc = "Setter for the `onshow` field of this object."]
68    #[doc = ""]
69    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onshow)"]
70    #[doc = ""]
71    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
72    pub fn set_onshow(this: &Notification, value: Option<&::js_sys::Function>);
73    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "onerror")]
74    #[doc = "Getter for the `onerror` field of this object."]
75    #[doc = ""]
76    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onerror)"]
77    #[doc = ""]
78    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
79    pub fn onerror(this: &Notification) -> Option<::js_sys::Function>;
80    #[wasm_bindgen(method, setter, js_class = "Notification", js_name = "onerror")]
81    #[doc = "Setter for the `onerror` field of this object."]
82    #[doc = ""]
83    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onerror)"]
84    #[doc = ""]
85    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
86    pub fn set_onerror(this: &Notification, value: Option<&::js_sys::Function>);
87    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "onclose")]
88    #[doc = "Getter for the `onclose` field of this object."]
89    #[doc = ""]
90    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclose)"]
91    #[doc = ""]
92    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
93    pub fn onclose(this: &Notification) -> Option<::js_sys::Function>;
94    #[wasm_bindgen(method, setter, js_class = "Notification", js_name = "onclose")]
95    #[doc = "Setter for the `onclose` field of this object."]
96    #[doc = ""]
97    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclose)"]
98    #[doc = ""]
99    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
100    pub fn set_onclose(this: &Notification, value: Option<&::js_sys::Function>);
101    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "title")]
102    #[doc = "Getter for the `title` field of this object."]
103    #[doc = ""]
104    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/title)"]
105    #[doc = ""]
106    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
107    pub fn title(this: &Notification) -> ::alloc::string::String;
108    #[cfg(feature = "NotificationDirection")]
109    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "dir")]
110    #[doc = "Getter for the `dir` field of this object."]
111    #[doc = ""]
112    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/dir)"]
113    #[doc = ""]
114    #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationDirection`*"]
115    pub fn dir(this: &Notification) -> NotificationDirection;
116    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "lang")]
117    #[doc = "Getter for the `lang` field of this object."]
118    #[doc = ""]
119    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/lang)"]
120    #[doc = ""]
121    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
122    pub fn lang(this: &Notification) -> Option<::alloc::string::String>;
123    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "body")]
124    #[doc = "Getter for the `body` field of this object."]
125    #[doc = ""]
126    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/body)"]
127    #[doc = ""]
128    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
129    pub fn body(this: &Notification) -> Option<::alloc::string::String>;
130    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "tag")]
131    #[doc = "Getter for the `tag` field of this object."]
132    #[doc = ""]
133    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/tag)"]
134    #[doc = ""]
135    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
136    pub fn tag(this: &Notification) -> Option<::alloc::string::String>;
137    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "image")]
138    #[doc = "Getter for the `image` field of this object."]
139    #[doc = ""]
140    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/image)"]
141    #[doc = ""]
142    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
143    pub fn image(this: &Notification) -> ::alloc::string::String;
144    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "icon")]
145    #[doc = "Getter for the `icon` field of this object."]
146    #[doc = ""]
147    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/icon)"]
148    #[doc = ""]
149    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
150    pub fn icon(this: &Notification) -> Option<::alloc::string::String>;
151    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "badge")]
152    #[doc = "Getter for the `badge` field of this object."]
153    #[doc = ""]
154    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/badge)"]
155    #[doc = ""]
156    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
157    pub fn badge(this: &Notification) -> ::alloc::string::String;
158    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "vibrate")]
159    #[doc = "Getter for the `vibrate` field of this object."]
160    #[doc = ""]
161    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate)"]
162    #[doc = ""]
163    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
164    pub fn vibrate(this: &Notification) -> ::js_sys::Array;
165    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "timestamp")]
166    #[doc = "Getter for the `timestamp` field of this object."]
167    #[doc = ""]
168    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/timestamp)"]
169    #[doc = ""]
170    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
171    pub fn timestamp(this: &Notification) -> f64;
172    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "renotify")]
173    #[doc = "Getter for the `renotify` field of this object."]
174    #[doc = ""]
175    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/renotify)"]
176    #[doc = ""]
177    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
178    pub fn renotify(this: &Notification) -> bool;
179    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "silent")]
180    #[doc = "Getter for the `silent` field of this object."]
181    #[doc = ""]
182    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/silent)"]
183    #[doc = ""]
184    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
185    pub fn silent(this: &Notification) -> Option<bool>;
186    #[wasm_bindgen(
187        method,
188        getter,
189        js_class = "Notification",
190        js_name = "requireInteraction"
191    )]
192    #[doc = "Getter for the `requireInteraction` field of this object."]
193    #[doc = ""]
194    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requireInteraction)"]
195    #[doc = ""]
196    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
197    pub fn require_interaction(this: &Notification) -> bool;
198    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "data")]
199    #[doc = "Getter for the `data` field of this object."]
200    #[doc = ""]
201    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/data)"]
202    #[doc = ""]
203    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
204    pub fn data(this: &Notification) -> ::wasm_bindgen::JsValue;
205    #[wasm_bindgen(method, getter, js_class = "Notification", js_name = "actions")]
206    #[doc = "Getter for the `actions` field of this object."]
207    #[doc = ""]
208    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/actions)"]
209    #[doc = ""]
210    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
211    pub fn actions(this: &Notification) -> ::js_sys::Array;
212    #[wasm_bindgen(catch, constructor, js_class = "Notification")]
213    #[doc = "The `new Notification(..)` constructor, creating a new instance of `Notification`."]
214    #[doc = ""]
215    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification)"]
216    #[doc = ""]
217    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
218    pub fn new(title: &str) -> Result<Notification, JsValue>;
219    #[cfg(feature = "NotificationOptions")]
220    #[wasm_bindgen(catch, constructor, js_class = "Notification")]
221    #[doc = "The `new Notification(..)` constructor, creating a new instance of `Notification`."]
222    #[doc = ""]
223    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification)"]
224    #[doc = ""]
225    #[doc = "*This API requires the following crate features to be activated: `Notification`, `NotificationOptions`*"]
226    pub fn new_with_options(
227        title: &str,
228        options: &NotificationOptions,
229    ) -> Result<Notification, JsValue>;
230    #[wasm_bindgen(method, js_class = "Notification")]
231    #[doc = "The `close()` method."]
232    #[doc = ""]
233    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/close)"]
234    #[doc = ""]
235    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
236    pub fn close(this: &Notification);
237    #[wasm_bindgen(
238        catch,
239        static_method_of = "Notification",
240        js_class = "Notification",
241        js_name = "requestPermission"
242    )]
243    #[doc = "The `requestPermission()` method."]
244    #[doc = ""]
245    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static)"]
246    #[doc = ""]
247    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
248    pub fn request_permission() -> Result<::js_sys::Promise, JsValue>;
249    #[wasm_bindgen(
250        catch,
251        static_method_of = "Notification",
252        js_class = "Notification",
253        js_name = "requestPermission"
254    )]
255    #[doc = "The `requestPermission()` method."]
256    #[doc = ""]
257    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static)"]
258    #[doc = ""]
259    #[doc = "*This API requires the following crate features to be activated: `Notification`*"]
260    pub fn request_permission_with_permission_callback(
261        permission_callback: &::js_sys::Function,
262    ) -> Result<::js_sys::Promise, JsValue>;
263}