1 | #![allow (unused_imports)] |
2 | #![allow (clippy::all)] |
3 | use super::*; |
4 | use wasm_bindgen::prelude::*; |
5 | #[wasm_bindgen ] |
6 | extern "C" { |
7 | # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = Worker , typescript_type = "Worker" )] |
8 | #[derive (Debug, Clone, PartialEq, Eq)] |
9 | #[doc = "The `Worker` class." ] |
10 | #[doc = "" ] |
11 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker)" ] |
12 | #[doc = "" ] |
13 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
14 | pub type Worker; |
15 | # [wasm_bindgen (structural , method , getter , js_class = "Worker" , js_name = onmessage)] |
16 | #[doc = "Getter for the `onmessage` field of this object." ] |
17 | #[doc = "" ] |
18 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onmessage)" ] |
19 | #[doc = "" ] |
20 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
21 | pub fn onmessage(this: &Worker) -> Option<::js_sys::Function>; |
22 | # [wasm_bindgen (structural , method , setter , js_class = "Worker" , js_name = onmessage)] |
23 | #[doc = "Setter for the `onmessage` field of this object." ] |
24 | #[doc = "" ] |
25 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onmessage)" ] |
26 | #[doc = "" ] |
27 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
28 | pub fn set_onmessage(this: &Worker, value: Option<&::js_sys::Function>); |
29 | # [wasm_bindgen (structural , method , getter , js_class = "Worker" , js_name = onmessageerror)] |
30 | #[doc = "Getter for the `onmessageerror` field of this object." ] |
31 | #[doc = "" ] |
32 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onmessageerror)" ] |
33 | #[doc = "" ] |
34 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
35 | pub fn onmessageerror(this: &Worker) -> Option<::js_sys::Function>; |
36 | # [wasm_bindgen (structural , method , setter , js_class = "Worker" , js_name = onmessageerror)] |
37 | #[doc = "Setter for the `onmessageerror` field of this object." ] |
38 | #[doc = "" ] |
39 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onmessageerror)" ] |
40 | #[doc = "" ] |
41 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
42 | pub fn set_onmessageerror(this: &Worker, value: Option<&::js_sys::Function>); |
43 | # [wasm_bindgen (structural , method , getter , js_class = "Worker" , js_name = onerror)] |
44 | #[doc = "Getter for the `onerror` field of this object." ] |
45 | #[doc = "" ] |
46 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onerror)" ] |
47 | #[doc = "" ] |
48 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
49 | pub fn onerror(this: &Worker) -> Option<::js_sys::Function>; |
50 | # [wasm_bindgen (structural , method , setter , js_class = "Worker" , js_name = onerror)] |
51 | #[doc = "Setter for the `onerror` field of this object." ] |
52 | #[doc = "" ] |
53 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/onerror)" ] |
54 | #[doc = "" ] |
55 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
56 | pub fn set_onerror(this: &Worker, value: Option<&::js_sys::Function>); |
57 | #[wasm_bindgen (catch, constructor, js_class = "Worker" )] |
58 | #[doc = "The `new Worker(..)` constructor, creating a new instance of `Worker`." ] |
59 | #[doc = "" ] |
60 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker)" ] |
61 | #[doc = "" ] |
62 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
63 | pub fn new(script_url: &str) -> Result<Worker, JsValue>; |
64 | #[cfg (feature = "WorkerOptions" )] |
65 | #[wasm_bindgen (catch, constructor, js_class = "Worker" )] |
66 | #[doc = "The `new Worker(..)` constructor, creating a new instance of `Worker`." ] |
67 | #[doc = "" ] |
68 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker)" ] |
69 | #[doc = "" ] |
70 | #[doc = "*This API requires the following crate features to be activated: `Worker`, `WorkerOptions`*" ] |
71 | pub fn new_with_options(script_url: &str, options: &WorkerOptions) -> Result<Worker, JsValue>; |
72 | # [wasm_bindgen (catch , method , structural , js_class = "Worker" , js_name = postMessage)] |
73 | #[doc = "The `postMessage()` method." ] |
74 | #[doc = "" ] |
75 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage)" ] |
76 | #[doc = "" ] |
77 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
78 | pub fn post_message(this: &Worker, message: &::wasm_bindgen::JsValue) -> Result<(), JsValue>; |
79 | # [wasm_bindgen (catch , method , structural , js_class = "Worker" , js_name = postMessage)] |
80 | #[doc = "The `postMessage()` method." ] |
81 | #[doc = "" ] |
82 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage)" ] |
83 | #[doc = "" ] |
84 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
85 | pub fn post_message_with_transfer( |
86 | this: &Worker, |
87 | message: &::wasm_bindgen::JsValue, |
88 | transfer: &::wasm_bindgen::JsValue, |
89 | ) -> Result<(), JsValue>; |
90 | # [wasm_bindgen (method , structural , js_class = "Worker" , js_name = terminate)] |
91 | #[doc = "The `terminate()` method." ] |
92 | #[doc = "" ] |
93 | #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate)" ] |
94 | #[doc = "" ] |
95 | #[doc = "*This API requires the following crate features to be activated: `Worker`*" ] |
96 | pub fn terminate(this: &Worker); |
97 | } |
98 | |