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