Skip to main content

web_sys/features/
gen_ServiceWorkerRegistration.rs

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