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