web_sys/features/
gen_WorkerOptions.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WorkerOptions)]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `WorkerOptions` dictionary."]
10 #[doc = ""]
11 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"]
12 pub type WorkerOptions;
13 #[cfg(feature = "RequestCredentials")]
14 #[doc = "Get the `credentials` field of this object."]
15 #[doc = ""]
16 #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"]
17 #[wasm_bindgen(method, getter = "credentials")]
18 pub fn get_credentials(this: &WorkerOptions) -> Option<RequestCredentials>;
19 #[cfg(feature = "RequestCredentials")]
20 #[doc = "Change the `credentials` field of this object."]
21 #[doc = ""]
22 #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `WorkerOptions`*"]
23 #[wasm_bindgen(method, setter = "credentials")]
24 pub fn set_credentials(this: &WorkerOptions, val: RequestCredentials);
25 #[doc = "Get the `name` field of this object."]
26 #[doc = ""]
27 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"]
28 #[wasm_bindgen(method, getter = "name")]
29 pub fn get_name(this: &WorkerOptions) -> Option<::alloc::string::String>;
30 #[doc = "Change the `name` field of this object."]
31 #[doc = ""]
32 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"]
33 #[wasm_bindgen(method, setter = "name")]
34 pub fn set_name(this: &WorkerOptions, val: &str);
35 #[cfg(feature = "WorkerType")]
36 #[doc = "Get the `type` field of this object."]
37 #[doc = ""]
38 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"]
39 #[wasm_bindgen(method, getter = "type")]
40 pub fn get_type(this: &WorkerOptions) -> Option<WorkerType>;
41 #[cfg(feature = "WorkerType")]
42 #[doc = "Change the `type` field of this object."]
43 #[doc = ""]
44 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`, `WorkerType`*"]
45 #[wasm_bindgen(method, setter = "type")]
46 pub fn set_type(this: &WorkerOptions, val: WorkerType);
47}
48impl WorkerOptions {
49 #[doc = "Construct a new `WorkerOptions`."]
50 #[doc = ""]
51 #[doc = "*This API requires the following crate features to be activated: `WorkerOptions`*"]
52 pub fn new() -> Self {
53 #[allow(unused_mut)]
54 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
55 ret
56 }
57 #[cfg(feature = "RequestCredentials")]
58 #[deprecated = "Use `set_credentials()` instead."]
59 pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self {
60 self.set_credentials(val);
61 self
62 }
63 #[deprecated = "Use `set_name()` instead."]
64 pub fn name(&mut self, val: &str) -> &mut Self {
65 self.set_name(val);
66 self
67 }
68 #[cfg(feature = "WorkerType")]
69 #[deprecated = "Use `set_type()` instead."]
70 pub fn type_(&mut self, val: WorkerType) -> &mut Self {
71 self.set_type(val);
72 self
73 }
74}
75impl Default for WorkerOptions {
76 fn default() -> Self {
77 Self::new()
78 }
79}