web_sys/features/
gen_ServiceWorker.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 = ServiceWorker , typescript_type = "ServiceWorker")]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `ServiceWorker` class."]
10 #[doc = ""]
11 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker)"]
12 #[doc = ""]
13 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
14 pub type ServiceWorker;
15 # [wasm_bindgen (structural , method , getter , js_class = "ServiceWorker" , js_name = scriptURL)]
16 #[doc = "Getter for the `scriptURL` field of this object."]
17 #[doc = ""]
18 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL)"]
19 #[doc = ""]
20 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
21 pub fn script_url(this: &ServiceWorker) -> ::alloc::string::String;
22 #[cfg(feature = "ServiceWorkerState")]
23 # [wasm_bindgen (structural , method , getter , js_class = "ServiceWorker" , js_name = state)]
24 #[doc = "Getter for the `state` field of this object."]
25 #[doc = ""]
26 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state)"]
27 #[doc = ""]
28 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`, `ServiceWorkerState`*"]
29 pub fn state(this: &ServiceWorker) -> ServiceWorkerState;
30 # [wasm_bindgen (structural , method , getter , js_class = "ServiceWorker" , js_name = onstatechange)]
31 #[doc = "Getter for the `onstatechange` field of this object."]
32 #[doc = ""]
33 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange)"]
34 #[doc = ""]
35 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
36 pub fn onstatechange(this: &ServiceWorker) -> Option<::js_sys::Function>;
37 # [wasm_bindgen (structural , method , setter , js_class = "ServiceWorker" , js_name = onstatechange)]
38 #[doc = "Setter for the `onstatechange` field of this object."]
39 #[doc = ""]
40 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange)"]
41 #[doc = ""]
42 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
43 pub fn set_onstatechange(this: &ServiceWorker, value: Option<&::js_sys::Function>);
44 # [wasm_bindgen (structural , method , getter , js_class = "ServiceWorker" , js_name = onerror)]
45 #[doc = "Getter for the `onerror` field of this object."]
46 #[doc = ""]
47 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onerror)"]
48 #[doc = ""]
49 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
50 pub fn onerror(this: &ServiceWorker) -> Option<::js_sys::Function>;
51 # [wasm_bindgen (structural , method , setter , js_class = "ServiceWorker" , js_name = onerror)]
52 #[doc = "Setter for the `onerror` field of this object."]
53 #[doc = ""]
54 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onerror)"]
55 #[doc = ""]
56 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
57 pub fn set_onerror(this: &ServiceWorker, value: Option<&::js_sys::Function>);
58 # [wasm_bindgen (catch , method , structural , js_class = "ServiceWorker" , js_name = postMessage)]
59 #[doc = "The `postMessage()` method."]
60 #[doc = ""]
61 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/postMessage)"]
62 #[doc = ""]
63 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
64 pub fn post_message(
65 this: &ServiceWorker,
66 message: &::wasm_bindgen::JsValue,
67 ) -> Result<(), JsValue>;
68 # [wasm_bindgen (catch , method , structural , js_class = "ServiceWorker" , js_name = postMessage)]
69 #[doc = "The `postMessage()` method."]
70 #[doc = ""]
71 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/postMessage)"]
72 #[doc = ""]
73 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`*"]
74 pub fn post_message_with_transferable(
75 this: &ServiceWorker,
76 message: &::wasm_bindgen::JsValue,
77 transferable: &::wasm_bindgen::JsValue,
78 ) -> Result<(), JsValue>;
79}