1 #![allow(unused_imports)]
2 use super::*;
3 use wasm_bindgen::prelude::*;
4 #[wasm_bindgen]
5 extern "C" {
6     # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebGLContextAttributes)]
7     #[derive(Debug, Clone, PartialEq, Eq)]
8     #[doc = "The `WebGlContextAttributes` dictionary."]
9     #[doc = ""]
10     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
11     pub type WebGlContextAttributes;
12 }
13 impl WebGlContextAttributes {
14     #[doc = "Construct a new `WebGlContextAttributes`."]
15     #[doc = ""]
16     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
new() -> Self17     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 `alpha` field of this object."]
23     #[doc = ""]
24     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
alpha(&mut self, val: bool) -> &mut Self25     pub fn alpha(&mut self, val: bool) -> &mut Self {
26         use wasm_bindgen::JsValue;
27         let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha"), &JsValue::from(val));
28         debug_assert!(
29             r.is_ok(),
30             "setting properties should never fail on our dictionary objects"
31         );
32         let _ = r;
33         self
34     }
35     #[doc = "Change the `antialias` field of this object."]
36     #[doc = ""]
37     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
antialias(&mut self, val: bool) -> &mut Self38     pub fn antialias(&mut self, val: bool) -> &mut Self {
39         use wasm_bindgen::JsValue;
40         let r = ::js_sys::Reflect::set(
41             self.as_ref(),
42             &JsValue::from("antialias"),
43             &JsValue::from(val),
44         );
45         debug_assert!(
46             r.is_ok(),
47             "setting properties should never fail on our dictionary objects"
48         );
49         let _ = r;
50         self
51     }
52     #[doc = "Change the `depth` field of this object."]
53     #[doc = ""]
54     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
depth(&mut self, val: bool) -> &mut Self55     pub fn depth(&mut self, val: bool) -> &mut Self {
56         use wasm_bindgen::JsValue;
57         let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("depth"), &JsValue::from(val));
58         debug_assert!(
59             r.is_ok(),
60             "setting properties should never fail on our dictionary objects"
61         );
62         let _ = r;
63         self
64     }
65     #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object."]
66     #[doc = ""]
67     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self68     pub fn fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self {
69         use wasm_bindgen::JsValue;
70         let r = ::js_sys::Reflect::set(
71             self.as_ref(),
72             &JsValue::from("failIfMajorPerformanceCaveat"),
73             &JsValue::from(val),
74         );
75         debug_assert!(
76             r.is_ok(),
77             "setting properties should never fail on our dictionary objects"
78         );
79         let _ = r;
80         self
81     }
82     #[cfg(feature = "WebGlPowerPreference")]
83     #[doc = "Change the `powerPreference` field of this object."]
84     #[doc = ""]
85     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*"]
power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self86     pub fn power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self {
87         use wasm_bindgen::JsValue;
88         let r = ::js_sys::Reflect::set(
89             self.as_ref(),
90             &JsValue::from("powerPreference"),
91             &JsValue::from(val),
92         );
93         debug_assert!(
94             r.is_ok(),
95             "setting properties should never fail on our dictionary objects"
96         );
97         let _ = r;
98         self
99     }
100     #[doc = "Change the `premultipliedAlpha` field of this object."]
101     #[doc = ""]
102     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
premultiplied_alpha(&mut self, val: bool) -> &mut Self103     pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self {
104         use wasm_bindgen::JsValue;
105         let r = ::js_sys::Reflect::set(
106             self.as_ref(),
107             &JsValue::from("premultipliedAlpha"),
108             &JsValue::from(val),
109         );
110         debug_assert!(
111             r.is_ok(),
112             "setting properties should never fail on our dictionary objects"
113         );
114         let _ = r;
115         self
116     }
117     #[doc = "Change the `preserveDrawingBuffer` field of this object."]
118     #[doc = ""]
119     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
preserve_drawing_buffer(&mut self, val: bool) -> &mut Self120     pub fn preserve_drawing_buffer(&mut self, val: bool) -> &mut Self {
121         use wasm_bindgen::JsValue;
122         let r = ::js_sys::Reflect::set(
123             self.as_ref(),
124             &JsValue::from("preserveDrawingBuffer"),
125             &JsValue::from(val),
126         );
127         debug_assert!(
128             r.is_ok(),
129             "setting properties should never fail on our dictionary objects"
130         );
131         let _ = r;
132         self
133     }
134     #[doc = "Change the `stencil` field of this object."]
135     #[doc = ""]
136     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
stencil(&mut self, val: bool) -> &mut Self137     pub fn stencil(&mut self, val: bool) -> &mut Self {
138         use wasm_bindgen::JsValue;
139         let r = ::js_sys::Reflect::set(
140             self.as_ref(),
141             &JsValue::from("stencil"),
142             &JsValue::from(val),
143         );
144         debug_assert!(
145             r.is_ok(),
146             "setting properties should never fail on our dictionary objects"
147         );
148         let _ = r;
149         self
150     }
151     #[doc = "Change the `xrCompatible` field of this object."]
152     #[doc = ""]
153     #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*"]
xr_compatible(&mut self, val: bool) -> &mut Self154     pub fn xr_compatible(&mut self, val: bool) -> &mut Self {
155         use wasm_bindgen::JsValue;
156         let r = ::js_sys::Reflect::set(
157             self.as_ref(),
158             &JsValue::from("xrCompatible"),
159             &JsValue::from(val),
160         );
161         debug_assert!(
162             r.is_ok(),
163             "setting properties should never fail on our dictionary objects"
164         );
165         let _ = r;
166         self
167     }
168 }
169 impl Default for WebGlContextAttributes {
default() -> Self170     fn default() -> Self {
171         Self::new()
172     }
173 }
174