maxcountryman_web_sys/features/
gen_WheelEventInit.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WheelEventInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `WheelEventInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
11    pub type WheelEventInit;
12}
13impl WheelEventInit {
14    #[doc = "Construct a new `WheelEventInit`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
17    pub fn new() -> Self {
18        #[allow(unused_mut)]
19        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20        ret
21    }
22    #[doc = "Change the `bubbles` field of this object."]
23    #[doc = ""]
24    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
25    pub fn bubbles(&mut self, val: bool) -> &mut Self {
26        use wasm_bindgen::JsValue;
27        let r = ::js_sys::Reflect::set(
28            self.as_ref(),
29            &JsValue::from("bubbles"),
30            &JsValue::from(val),
31        );
32        debug_assert!(
33            r.is_ok(),
34            "setting properties should never fail on our dictionary objects"
35        );
36        let _ = r;
37        self
38    }
39    #[doc = "Change the `cancelable` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
42    pub fn cancelable(&mut self, val: bool) -> &mut Self {
43        use wasm_bindgen::JsValue;
44        let r = ::js_sys::Reflect::set(
45            self.as_ref(),
46            &JsValue::from("cancelable"),
47            &JsValue::from(val),
48        );
49        debug_assert!(
50            r.is_ok(),
51            "setting properties should never fail on our dictionary objects"
52        );
53        let _ = r;
54        self
55    }
56    #[doc = "Change the `composed` field of this object."]
57    #[doc = ""]
58    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
59    pub fn composed(&mut self, val: bool) -> &mut Self {
60        use wasm_bindgen::JsValue;
61        let r = ::js_sys::Reflect::set(
62            self.as_ref(),
63            &JsValue::from("composed"),
64            &JsValue::from(val),
65        );
66        debug_assert!(
67            r.is_ok(),
68            "setting properties should never fail on our dictionary objects"
69        );
70        let _ = r;
71        self
72    }
73    #[doc = "Change the `detail` field of this object."]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
76    pub fn detail(&mut self, val: i32) -> &mut Self {
77        use wasm_bindgen::JsValue;
78        let r =
79            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val));
80        debug_assert!(
81            r.is_ok(),
82            "setting properties should never fail on our dictionary objects"
83        );
84        let _ = r;
85        self
86    }
87    #[cfg(feature = "Window")]
88    #[doc = "Change the `view` field of this object."]
89    #[doc = ""]
90    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`, `Window`*"]
91    pub fn view(&mut self, val: Option<&Window>) -> &mut Self {
92        use wasm_bindgen::JsValue;
93        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val));
94        debug_assert!(
95            r.is_ok(),
96            "setting properties should never fail on our dictionary objects"
97        );
98        let _ = r;
99        self
100    }
101    #[doc = "Change the `altKey` field of this object."]
102    #[doc = ""]
103    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
104    pub fn alt_key(&mut self, val: bool) -> &mut Self {
105        use wasm_bindgen::JsValue;
106        let r =
107            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val));
108        debug_assert!(
109            r.is_ok(),
110            "setting properties should never fail on our dictionary objects"
111        );
112        let _ = r;
113        self
114    }
115    #[doc = "Change the `ctrlKey` field of this object."]
116    #[doc = ""]
117    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
118    pub fn ctrl_key(&mut self, val: bool) -> &mut Self {
119        use wasm_bindgen::JsValue;
120        let r = ::js_sys::Reflect::set(
121            self.as_ref(),
122            &JsValue::from("ctrlKey"),
123            &JsValue::from(val),
124        );
125        debug_assert!(
126            r.is_ok(),
127            "setting properties should never fail on our dictionary objects"
128        );
129        let _ = r;
130        self
131    }
132    #[doc = "Change the `metaKey` field of this object."]
133    #[doc = ""]
134    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
135    pub fn meta_key(&mut self, val: bool) -> &mut Self {
136        use wasm_bindgen::JsValue;
137        let r = ::js_sys::Reflect::set(
138            self.as_ref(),
139            &JsValue::from("metaKey"),
140            &JsValue::from(val),
141        );
142        debug_assert!(
143            r.is_ok(),
144            "setting properties should never fail on our dictionary objects"
145        );
146        let _ = r;
147        self
148    }
149    #[doc = "Change the `modifierAltGraph` field of this object."]
150    #[doc = ""]
151    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
152    pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self {
153        use wasm_bindgen::JsValue;
154        let r = ::js_sys::Reflect::set(
155            self.as_ref(),
156            &JsValue::from("modifierAltGraph"),
157            &JsValue::from(val),
158        );
159        debug_assert!(
160            r.is_ok(),
161            "setting properties should never fail on our dictionary objects"
162        );
163        let _ = r;
164        self
165    }
166    #[doc = "Change the `modifierCapsLock` field of this object."]
167    #[doc = ""]
168    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
169    pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self {
170        use wasm_bindgen::JsValue;
171        let r = ::js_sys::Reflect::set(
172            self.as_ref(),
173            &JsValue::from("modifierCapsLock"),
174            &JsValue::from(val),
175        );
176        debug_assert!(
177            r.is_ok(),
178            "setting properties should never fail on our dictionary objects"
179        );
180        let _ = r;
181        self
182    }
183    #[doc = "Change the `modifierFn` field of this object."]
184    #[doc = ""]
185    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
186    pub fn modifier_fn(&mut self, val: bool) -> &mut Self {
187        use wasm_bindgen::JsValue;
188        let r = ::js_sys::Reflect::set(
189            self.as_ref(),
190            &JsValue::from("modifierFn"),
191            &JsValue::from(val),
192        );
193        debug_assert!(
194            r.is_ok(),
195            "setting properties should never fail on our dictionary objects"
196        );
197        let _ = r;
198        self
199    }
200    #[doc = "Change the `modifierFnLock` field of this object."]
201    #[doc = ""]
202    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
203    pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self {
204        use wasm_bindgen::JsValue;
205        let r = ::js_sys::Reflect::set(
206            self.as_ref(),
207            &JsValue::from("modifierFnLock"),
208            &JsValue::from(val),
209        );
210        debug_assert!(
211            r.is_ok(),
212            "setting properties should never fail on our dictionary objects"
213        );
214        let _ = r;
215        self
216    }
217    #[doc = "Change the `modifierNumLock` field of this object."]
218    #[doc = ""]
219    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
220    pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self {
221        use wasm_bindgen::JsValue;
222        let r = ::js_sys::Reflect::set(
223            self.as_ref(),
224            &JsValue::from("modifierNumLock"),
225            &JsValue::from(val),
226        );
227        debug_assert!(
228            r.is_ok(),
229            "setting properties should never fail on our dictionary objects"
230        );
231        let _ = r;
232        self
233    }
234    #[doc = "Change the `modifierOS` field of this object."]
235    #[doc = ""]
236    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
237    pub fn modifier_os(&mut self, val: bool) -> &mut Self {
238        use wasm_bindgen::JsValue;
239        let r = ::js_sys::Reflect::set(
240            self.as_ref(),
241            &JsValue::from("modifierOS"),
242            &JsValue::from(val),
243        );
244        debug_assert!(
245            r.is_ok(),
246            "setting properties should never fail on our dictionary objects"
247        );
248        let _ = r;
249        self
250    }
251    #[doc = "Change the `modifierScrollLock` field of this object."]
252    #[doc = ""]
253    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
254    pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self {
255        use wasm_bindgen::JsValue;
256        let r = ::js_sys::Reflect::set(
257            self.as_ref(),
258            &JsValue::from("modifierScrollLock"),
259            &JsValue::from(val),
260        );
261        debug_assert!(
262            r.is_ok(),
263            "setting properties should never fail on our dictionary objects"
264        );
265        let _ = r;
266        self
267    }
268    #[doc = "Change the `modifierSymbol` field of this object."]
269    #[doc = ""]
270    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
271    pub fn modifier_symbol(&mut self, val: bool) -> &mut Self {
272        use wasm_bindgen::JsValue;
273        let r = ::js_sys::Reflect::set(
274            self.as_ref(),
275            &JsValue::from("modifierSymbol"),
276            &JsValue::from(val),
277        );
278        debug_assert!(
279            r.is_ok(),
280            "setting properties should never fail on our dictionary objects"
281        );
282        let _ = r;
283        self
284    }
285    #[doc = "Change the `modifierSymbolLock` field of this object."]
286    #[doc = ""]
287    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
288    pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self {
289        use wasm_bindgen::JsValue;
290        let r = ::js_sys::Reflect::set(
291            self.as_ref(),
292            &JsValue::from("modifierSymbolLock"),
293            &JsValue::from(val),
294        );
295        debug_assert!(
296            r.is_ok(),
297            "setting properties should never fail on our dictionary objects"
298        );
299        let _ = r;
300        self
301    }
302    #[doc = "Change the `shiftKey` field of this object."]
303    #[doc = ""]
304    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
305    pub fn shift_key(&mut self, val: bool) -> &mut Self {
306        use wasm_bindgen::JsValue;
307        let r = ::js_sys::Reflect::set(
308            self.as_ref(),
309            &JsValue::from("shiftKey"),
310            &JsValue::from(val),
311        );
312        debug_assert!(
313            r.is_ok(),
314            "setting properties should never fail on our dictionary objects"
315        );
316        let _ = r;
317        self
318    }
319    #[doc = "Change the `button` field of this object."]
320    #[doc = ""]
321    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
322    pub fn button(&mut self, val: i16) -> &mut Self {
323        use wasm_bindgen::JsValue;
324        let r =
325            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("button"), &JsValue::from(val));
326        debug_assert!(
327            r.is_ok(),
328            "setting properties should never fail on our dictionary objects"
329        );
330        let _ = r;
331        self
332    }
333    #[doc = "Change the `buttons` field of this object."]
334    #[doc = ""]
335    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
336    pub fn buttons(&mut self, val: u16) -> &mut Self {
337        use wasm_bindgen::JsValue;
338        let r = ::js_sys::Reflect::set(
339            self.as_ref(),
340            &JsValue::from("buttons"),
341            &JsValue::from(val),
342        );
343        debug_assert!(
344            r.is_ok(),
345            "setting properties should never fail on our dictionary objects"
346        );
347        let _ = r;
348        self
349    }
350    #[doc = "Change the `clientX` field of this object."]
351    #[doc = ""]
352    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
353    pub fn client_x(&mut self, val: i32) -> &mut Self {
354        use wasm_bindgen::JsValue;
355        let r = ::js_sys::Reflect::set(
356            self.as_ref(),
357            &JsValue::from("clientX"),
358            &JsValue::from(val),
359        );
360        debug_assert!(
361            r.is_ok(),
362            "setting properties should never fail on our dictionary objects"
363        );
364        let _ = r;
365        self
366    }
367    #[doc = "Change the `clientY` field of this object."]
368    #[doc = ""]
369    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
370    pub fn client_y(&mut self, val: i32) -> &mut Self {
371        use wasm_bindgen::JsValue;
372        let r = ::js_sys::Reflect::set(
373            self.as_ref(),
374            &JsValue::from("clientY"),
375            &JsValue::from(val),
376        );
377        debug_assert!(
378            r.is_ok(),
379            "setting properties should never fail on our dictionary objects"
380        );
381        let _ = r;
382        self
383    }
384    #[doc = "Change the `movementX` field of this object."]
385    #[doc = ""]
386    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
387    pub fn movement_x(&mut self, val: i32) -> &mut Self {
388        use wasm_bindgen::JsValue;
389        let r = ::js_sys::Reflect::set(
390            self.as_ref(),
391            &JsValue::from("movementX"),
392            &JsValue::from(val),
393        );
394        debug_assert!(
395            r.is_ok(),
396            "setting properties should never fail on our dictionary objects"
397        );
398        let _ = r;
399        self
400    }
401    #[doc = "Change the `movementY` field of this object."]
402    #[doc = ""]
403    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
404    pub fn movement_y(&mut self, val: i32) -> &mut Self {
405        use wasm_bindgen::JsValue;
406        let r = ::js_sys::Reflect::set(
407            self.as_ref(),
408            &JsValue::from("movementY"),
409            &JsValue::from(val),
410        );
411        debug_assert!(
412            r.is_ok(),
413            "setting properties should never fail on our dictionary objects"
414        );
415        let _ = r;
416        self
417    }
418    #[cfg(feature = "EventTarget")]
419    #[doc = "Change the `relatedTarget` field of this object."]
420    #[doc = ""]
421    #[doc = "*This API requires the following crate features to be activated: `EventTarget`, `WheelEventInit`*"]
422    pub fn related_target(&mut self, val: Option<&EventTarget>) -> &mut Self {
423        use wasm_bindgen::JsValue;
424        let r = ::js_sys::Reflect::set(
425            self.as_ref(),
426            &JsValue::from("relatedTarget"),
427            &JsValue::from(val),
428        );
429        debug_assert!(
430            r.is_ok(),
431            "setting properties should never fail on our dictionary objects"
432        );
433        let _ = r;
434        self
435    }
436    #[doc = "Change the `screenX` field of this object."]
437    #[doc = ""]
438    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
439    pub fn screen_x(&mut self, val: i32) -> &mut Self {
440        use wasm_bindgen::JsValue;
441        let r = ::js_sys::Reflect::set(
442            self.as_ref(),
443            &JsValue::from("screenX"),
444            &JsValue::from(val),
445        );
446        debug_assert!(
447            r.is_ok(),
448            "setting properties should never fail on our dictionary objects"
449        );
450        let _ = r;
451        self
452    }
453    #[doc = "Change the `screenY` field of this object."]
454    #[doc = ""]
455    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
456    pub fn screen_y(&mut self, val: i32) -> &mut Self {
457        use wasm_bindgen::JsValue;
458        let r = ::js_sys::Reflect::set(
459            self.as_ref(),
460            &JsValue::from("screenY"),
461            &JsValue::from(val),
462        );
463        debug_assert!(
464            r.is_ok(),
465            "setting properties should never fail on our dictionary objects"
466        );
467        let _ = r;
468        self
469    }
470    #[doc = "Change the `deltaMode` field of this object."]
471    #[doc = ""]
472    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
473    pub fn delta_mode(&mut self, val: u32) -> &mut Self {
474        use wasm_bindgen::JsValue;
475        let r = ::js_sys::Reflect::set(
476            self.as_ref(),
477            &JsValue::from("deltaMode"),
478            &JsValue::from(val),
479        );
480        debug_assert!(
481            r.is_ok(),
482            "setting properties should never fail on our dictionary objects"
483        );
484        let _ = r;
485        self
486    }
487    #[doc = "Change the `deltaX` field of this object."]
488    #[doc = ""]
489    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
490    pub fn delta_x(&mut self, val: f64) -> &mut Self {
491        use wasm_bindgen::JsValue;
492        let r =
493            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaX"), &JsValue::from(val));
494        debug_assert!(
495            r.is_ok(),
496            "setting properties should never fail on our dictionary objects"
497        );
498        let _ = r;
499        self
500    }
501    #[doc = "Change the `deltaY` field of this object."]
502    #[doc = ""]
503    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
504    pub fn delta_y(&mut self, val: f64) -> &mut Self {
505        use wasm_bindgen::JsValue;
506        let r =
507            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaY"), &JsValue::from(val));
508        debug_assert!(
509            r.is_ok(),
510            "setting properties should never fail on our dictionary objects"
511        );
512        let _ = r;
513        self
514    }
515    #[doc = "Change the `deltaZ` field of this object."]
516    #[doc = ""]
517    #[doc = "*This API requires the following crate features to be activated: `WheelEventInit`*"]
518    pub fn delta_z(&mut self, val: f64) -> &mut Self {
519        use wasm_bindgen::JsValue;
520        let r =
521            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("deltaZ"), &JsValue::from(val));
522        debug_assert!(
523            r.is_ok(),
524            "setting properties should never fail on our dictionary objects"
525        );
526        let _ = r;
527        self
528    }
529}
530impl Default for WheelEventInit {
531    fn default() -> Self {
532        Self::new()
533    }
534}