maxcountryman_web_sys/features/
gen_SecurityPolicyViolationEventInit.rs1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SecurityPolicyViolationEventInit)]
7 #[derive(Debug, Clone, PartialEq, Eq)]
8 #[doc = "The `SecurityPolicyViolationEventInit` dictionary."]
9 #[doc = ""]
10 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
11 pub type SecurityPolicyViolationEventInit;
12}
13impl SecurityPolicyViolationEventInit {
14 #[doc = "Construct a new `SecurityPolicyViolationEventInit`."]
15 #[doc = ""]
16 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
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: `SecurityPolicyViolationEventInit`*"]
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: `SecurityPolicyViolationEventInit`*"]
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: `SecurityPolicyViolationEventInit`*"]
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 `blockedURI` field of this object."]
74 #[doc = ""]
75 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
76 pub fn blocked_uri(&mut self, val: &str) -> &mut Self {
77 use wasm_bindgen::JsValue;
78 let r = ::js_sys::Reflect::set(
79 self.as_ref(),
80 &JsValue::from("blockedURI"),
81 &JsValue::from(val),
82 );
83 debug_assert!(
84 r.is_ok(),
85 "setting properties should never fail on our dictionary objects"
86 );
87 let _ = r;
88 self
89 }
90 #[doc = "Change the `columnNumber` field of this object."]
91 #[doc = ""]
92 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
93 pub fn column_number(&mut self, val: i32) -> &mut Self {
94 use wasm_bindgen::JsValue;
95 let r = ::js_sys::Reflect::set(
96 self.as_ref(),
97 &JsValue::from("columnNumber"),
98 &JsValue::from(val),
99 );
100 debug_assert!(
101 r.is_ok(),
102 "setting properties should never fail on our dictionary objects"
103 );
104 let _ = r;
105 self
106 }
107 #[cfg(feature = "SecurityPolicyViolationEventDisposition")]
108 #[doc = "Change the `disposition` field of this object."]
109 #[doc = ""]
110 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventDisposition`, `SecurityPolicyViolationEventInit`*"]
111 pub fn disposition(&mut self, val: SecurityPolicyViolationEventDisposition) -> &mut Self {
112 use wasm_bindgen::JsValue;
113 let r = ::js_sys::Reflect::set(
114 self.as_ref(),
115 &JsValue::from("disposition"),
116 &JsValue::from(val),
117 );
118 debug_assert!(
119 r.is_ok(),
120 "setting properties should never fail on our dictionary objects"
121 );
122 let _ = r;
123 self
124 }
125 #[doc = "Change the `documentURI` field of this object."]
126 #[doc = ""]
127 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
128 pub fn document_uri(&mut self, val: &str) -> &mut Self {
129 use wasm_bindgen::JsValue;
130 let r = ::js_sys::Reflect::set(
131 self.as_ref(),
132 &JsValue::from("documentURI"),
133 &JsValue::from(val),
134 );
135 debug_assert!(
136 r.is_ok(),
137 "setting properties should never fail on our dictionary objects"
138 );
139 let _ = r;
140 self
141 }
142 #[doc = "Change the `effectiveDirective` field of this object."]
143 #[doc = ""]
144 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
145 pub fn effective_directive(&mut self, val: &str) -> &mut Self {
146 use wasm_bindgen::JsValue;
147 let r = ::js_sys::Reflect::set(
148 self.as_ref(),
149 &JsValue::from("effectiveDirective"),
150 &JsValue::from(val),
151 );
152 debug_assert!(
153 r.is_ok(),
154 "setting properties should never fail on our dictionary objects"
155 );
156 let _ = r;
157 self
158 }
159 #[doc = "Change the `lineNumber` field of this object."]
160 #[doc = ""]
161 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
162 pub fn line_number(&mut self, val: i32) -> &mut Self {
163 use wasm_bindgen::JsValue;
164 let r = ::js_sys::Reflect::set(
165 self.as_ref(),
166 &JsValue::from("lineNumber"),
167 &JsValue::from(val),
168 );
169 debug_assert!(
170 r.is_ok(),
171 "setting properties should never fail on our dictionary objects"
172 );
173 let _ = r;
174 self
175 }
176 #[doc = "Change the `originalPolicy` field of this object."]
177 #[doc = ""]
178 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
179 pub fn original_policy(&mut self, val: &str) -> &mut Self {
180 use wasm_bindgen::JsValue;
181 let r = ::js_sys::Reflect::set(
182 self.as_ref(),
183 &JsValue::from("originalPolicy"),
184 &JsValue::from(val),
185 );
186 debug_assert!(
187 r.is_ok(),
188 "setting properties should never fail on our dictionary objects"
189 );
190 let _ = r;
191 self
192 }
193 #[doc = "Change the `referrer` field of this object."]
194 #[doc = ""]
195 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
196 pub fn referrer(&mut self, val: &str) -> &mut Self {
197 use wasm_bindgen::JsValue;
198 let r = ::js_sys::Reflect::set(
199 self.as_ref(),
200 &JsValue::from("referrer"),
201 &JsValue::from(val),
202 );
203 debug_assert!(
204 r.is_ok(),
205 "setting properties should never fail on our dictionary objects"
206 );
207 let _ = r;
208 self
209 }
210 #[doc = "Change the `sample` field of this object."]
211 #[doc = ""]
212 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
213 pub fn sample(&mut self, val: &str) -> &mut Self {
214 use wasm_bindgen::JsValue;
215 let r =
216 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sample"), &JsValue::from(val));
217 debug_assert!(
218 r.is_ok(),
219 "setting properties should never fail on our dictionary objects"
220 );
221 let _ = r;
222 self
223 }
224 #[doc = "Change the `sourceFile` field of this object."]
225 #[doc = ""]
226 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
227 pub fn source_file(&mut self, val: &str) -> &mut Self {
228 use wasm_bindgen::JsValue;
229 let r = ::js_sys::Reflect::set(
230 self.as_ref(),
231 &JsValue::from("sourceFile"),
232 &JsValue::from(val),
233 );
234 debug_assert!(
235 r.is_ok(),
236 "setting properties should never fail on our dictionary objects"
237 );
238 let _ = r;
239 self
240 }
241 #[doc = "Change the `statusCode` field of this object."]
242 #[doc = ""]
243 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
244 pub fn status_code(&mut self, val: u16) -> &mut Self {
245 use wasm_bindgen::JsValue;
246 let r = ::js_sys::Reflect::set(
247 self.as_ref(),
248 &JsValue::from("statusCode"),
249 &JsValue::from(val),
250 );
251 debug_assert!(
252 r.is_ok(),
253 "setting properties should never fail on our dictionary objects"
254 );
255 let _ = r;
256 self
257 }
258 #[doc = "Change the `violatedDirective` field of this object."]
259 #[doc = ""]
260 #[doc = "*This API requires the following crate features to be activated: `SecurityPolicyViolationEventInit`*"]
261 pub fn violated_directive(&mut self, val: &str) -> &mut Self {
262 use wasm_bindgen::JsValue;
263 let r = ::js_sys::Reflect::set(
264 self.as_ref(),
265 &JsValue::from("violatedDirective"),
266 &JsValue::from(val),
267 );
268 debug_assert!(
269 r.is_ok(),
270 "setting properties should never fail on our dictionary objects"
271 );
272 let _ = r;
273 self
274 }
275}
276impl Default for SecurityPolicyViolationEventInit {
277 fn default() -> Self {
278 Self::new()
279 }
280}