web_sys/features/
gen_ServiceWorkerContainer.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 = "ServiceWorkerContainer",
11 typescript_type = "ServiceWorkerContainer"
12 )]
13 #[derive(Debug, Clone, PartialEq, Eq)]
14 #[doc = "The `ServiceWorkerContainer` class."]
15 #[doc = ""]
16 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer)"]
17 #[doc = ""]
18 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
19 pub type ServiceWorkerContainer;
20 #[cfg(feature = "ServiceWorker")]
21 #[wasm_bindgen(
22 method,
23 getter,
24 js_class = "ServiceWorkerContainer",
25 js_name = "controller"
26 )]
27 #[doc = "Getter for the `controller` field of this object."]
28 #[doc = ""]
29 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller)"]
30 #[doc = ""]
31 #[doc = "*This API requires the following crate features to be activated: `ServiceWorker`, `ServiceWorkerContainer`*"]
32 pub fn controller(this: &ServiceWorkerContainer) -> Option<ServiceWorker>;
33 #[wasm_bindgen(
34 catch,
35 method,
36 getter,
37 js_class = "ServiceWorkerContainer",
38 js_name = "ready"
39 )]
40 #[doc = "Getter for the `ready` field of this object."]
41 #[doc = ""]
42 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready)"]
43 #[doc = ""]
44 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
45 pub fn ready(this: &ServiceWorkerContainer) -> Result<::js_sys::Promise, JsValue>;
46 #[wasm_bindgen(
47 method,
48 getter,
49 js_class = "ServiceWorkerContainer",
50 js_name = "oncontrollerchange"
51 )]
52 #[doc = "Getter for the `oncontrollerchange` field of this object."]
53 #[doc = ""]
54 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange)"]
55 #[doc = ""]
56 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
57 pub fn oncontrollerchange(this: &ServiceWorkerContainer) -> Option<::js_sys::Function>;
58 #[wasm_bindgen(
59 method,
60 setter,
61 js_class = "ServiceWorkerContainer",
62 js_name = "oncontrollerchange"
63 )]
64 #[doc = "Setter for the `oncontrollerchange` field of this object."]
65 #[doc = ""]
66 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange)"]
67 #[doc = ""]
68 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
69 pub fn set_oncontrollerchange(
70 this: &ServiceWorkerContainer,
71 value: Option<&::js_sys::Function>,
72 );
73 #[wasm_bindgen(
74 method,
75 getter,
76 js_class = "ServiceWorkerContainer",
77 js_name = "onerror"
78 )]
79 #[doc = "Getter for the `onerror` field of this object."]
80 #[doc = ""]
81 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onerror)"]
82 #[doc = ""]
83 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
84 pub fn onerror(this: &ServiceWorkerContainer) -> Option<::js_sys::Function>;
85 #[wasm_bindgen(
86 method,
87 setter,
88 js_class = "ServiceWorkerContainer",
89 js_name = "onerror"
90 )]
91 #[doc = "Setter for the `onerror` field of this object."]
92 #[doc = ""]
93 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onerror)"]
94 #[doc = ""]
95 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
96 pub fn set_onerror(this: &ServiceWorkerContainer, value: Option<&::js_sys::Function>);
97 #[wasm_bindgen(
98 method,
99 getter,
100 js_class = "ServiceWorkerContainer",
101 js_name = "onmessage"
102 )]
103 #[doc = "Getter for the `onmessage` field of this object."]
104 #[doc = ""]
105 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onmessage)"]
106 #[doc = ""]
107 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
108 pub fn onmessage(this: &ServiceWorkerContainer) -> Option<::js_sys::Function>;
109 #[wasm_bindgen(
110 method,
111 setter,
112 js_class = "ServiceWorkerContainer",
113 js_name = "onmessage"
114 )]
115 #[doc = "Setter for the `onmessage` field of this object."]
116 #[doc = ""]
117 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onmessage)"]
118 #[doc = ""]
119 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
120 pub fn set_onmessage(this: &ServiceWorkerContainer, value: Option<&::js_sys::Function>);
121 #[wasm_bindgen(
122 method,
123 js_class = "ServiceWorkerContainer",
124 js_name = "getRegistration"
125 )]
126 #[doc = "The `getRegistration()` method."]
127 #[doc = ""]
128 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/getRegistration)"]
129 #[doc = ""]
130 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
131 pub fn get_registration(this: &ServiceWorkerContainer) -> ::js_sys::Promise;
132 #[wasm_bindgen(
133 method,
134 js_class = "ServiceWorkerContainer",
135 js_name = "getRegistration"
136 )]
137 #[doc = "The `getRegistration()` method."]
138 #[doc = ""]
139 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/getRegistration)"]
140 #[doc = ""]
141 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
142 pub fn get_registration_with_document_url(
143 this: &ServiceWorkerContainer,
144 document_url: &str,
145 ) -> ::js_sys::Promise;
146 #[wasm_bindgen(
147 method,
148 js_class = "ServiceWorkerContainer",
149 js_name = "getRegistrations"
150 )]
151 #[doc = "The `getRegistrations()` method."]
152 #[doc = ""]
153 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/getRegistrations)"]
154 #[doc = ""]
155 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
156 pub fn get_registrations(this: &ServiceWorkerContainer) -> ::js_sys::Promise;
157 #[wasm_bindgen(
158 catch,
159 method,
160 js_class = "ServiceWorkerContainer",
161 js_name = "getScopeForUrl"
162 )]
163 #[doc = "The `getScopeForUrl()` method."]
164 #[doc = ""]
165 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/getScopeForUrl)"]
166 #[doc = ""]
167 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
168 pub fn get_scope_for_url(
169 this: &ServiceWorkerContainer,
170 url: &str,
171 ) -> Result<::alloc::string::String, JsValue>;
172 #[wasm_bindgen(method, js_class = "ServiceWorkerContainer")]
173 #[doc = "The `register()` method."]
174 #[doc = ""]
175 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register)"]
176 #[doc = ""]
177 #[doc = "*This API requires the following crate features to be activated: `ServiceWorkerContainer`*"]
178 pub fn register(this: &ServiceWorkerContainer, script_url: &str) -> ::js_sys::Promise;
179 #[cfg(feature = "RegistrationOptions")]
180 #[wasm_bindgen(method, js_class = "ServiceWorkerContainer", js_name = "register")]
181 #[doc = "The `register()` method."]
182 #[doc = ""]
183 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register)"]
184 #[doc = ""]
185 #[doc = "*This API requires the following crate features to be activated: `RegistrationOptions`, `ServiceWorkerContainer`*"]
186 pub fn register_with_options(
187 this: &ServiceWorkerContainer,
188 script_url: &str,
189 options: &RegistrationOptions,
190 ) -> ::js_sys::Promise;
191}