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