web_sys/features/
gen_SharedWorker.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = SharedWorker , typescript_type = "SharedWorker")]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `SharedWorker` class."]
10 #[doc = ""]
11 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker)"]
12 #[doc = ""]
13 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`*"]
14 pub type SharedWorker;
15 #[cfg(feature = "MessagePort")]
16 # [wasm_bindgen (structural , method , getter , js_class = "SharedWorker" , js_name = port)]
17 #[doc = "Getter for the `port` field of this object."]
18 #[doc = ""]
19 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/port)"]
20 #[doc = ""]
21 #[doc = "*This API requires the following crate features to be activated: `MessagePort`, `SharedWorker`*"]
22 pub fn port(this: &SharedWorker) -> MessagePort;
23 # [wasm_bindgen (structural , method , getter , js_class = "SharedWorker" , js_name = onerror)]
24 #[doc = "Getter for the `onerror` field of this object."]
25 #[doc = ""]
26 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/onerror)"]
27 #[doc = ""]
28 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`*"]
29 pub fn onerror(this: &SharedWorker) -> Option<::js_sys::Function>;
30 # [wasm_bindgen (structural , method , setter , js_class = "SharedWorker" , js_name = onerror)]
31 #[doc = "Setter for the `onerror` field of this object."]
32 #[doc = ""]
33 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/onerror)"]
34 #[doc = ""]
35 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`*"]
36 pub fn set_onerror(this: &SharedWorker, value: Option<&::js_sys::Function>);
37 #[wasm_bindgen(catch, constructor, js_class = "SharedWorker")]
38 #[doc = "The `new SharedWorker(..)` constructor, creating a new instance of `SharedWorker`."]
39 #[doc = ""]
40 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/SharedWorker)"]
41 #[doc = ""]
42 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`*"]
43 pub fn new(script_url: &str) -> Result<SharedWorker, JsValue>;
44 #[wasm_bindgen(catch, constructor, js_class = "SharedWorker")]
45 #[doc = "The `new SharedWorker(..)` constructor, creating a new instance of `SharedWorker`."]
46 #[doc = ""]
47 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/SharedWorker)"]
48 #[doc = ""]
49 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`*"]
50 pub fn new_with_str(script_url: &str, options: &str) -> Result<SharedWorker, JsValue>;
51 #[cfg(feature = "WorkerOptions")]
52 #[wasm_bindgen(catch, constructor, js_class = "SharedWorker")]
53 #[doc = "The `new SharedWorker(..)` constructor, creating a new instance of `SharedWorker`."]
54 #[doc = ""]
55 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/SharedWorker)"]
56 #[doc = ""]
57 #[doc = "*This API requires the following crate features to be activated: `SharedWorker`, `WorkerOptions`*"]
58 pub fn new_with_worker_options(
59 script_url: &str,
60 options: &WorkerOptions,
61 ) -> Result<SharedWorker, JsValue>;
62}