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