Skip to main content

web_sys/features/
gen_PushSubscription.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 = "::js_sys::Object",
9        js_name = "PushSubscription",
10        typescript_type = "PushSubscription"
11    )]
12    #[derive(Debug, Clone, PartialEq, Eq)]
13    #[doc = "The `PushSubscription` class."]
14    #[doc = ""]
15    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)"]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `PushSubscription`*"]
18    pub type PushSubscription;
19    #[wasm_bindgen(method, getter, js_class = "PushSubscription", js_name = "endpoint")]
20    #[doc = "Getter for the `endpoint` field of this object."]
21    #[doc = ""]
22    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/endpoint)"]
23    #[doc = ""]
24    #[doc = "*This API requires the following crate features to be activated: `PushSubscription`*"]
25    pub fn endpoint(this: &PushSubscription) -> ::alloc::string::String;
26    #[cfg(feature = "PushSubscriptionOptions")]
27    #[wasm_bindgen(method, getter, js_class = "PushSubscription", js_name = "options")]
28    #[doc = "Getter for the `options` field of this object."]
29    #[doc = ""]
30    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/options)"]
31    #[doc = ""]
32    #[doc = "*This API requires the following crate features to be activated: `PushSubscription`, `PushSubscriptionOptions`*"]
33    pub fn options(this: &PushSubscription) -> PushSubscriptionOptions;
34    #[cfg(feature = "PushEncryptionKeyName")]
35    #[wasm_bindgen(catch, method, js_class = "PushSubscription", js_name = "getKey")]
36    #[doc = "The `getKey()` method."]
37    #[doc = ""]
38    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/getKey)"]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `PushEncryptionKeyName`, `PushSubscription`*"]
41    pub fn get_key(
42        this: &PushSubscription,
43        name: PushEncryptionKeyName,
44    ) -> Result<Option<::js_sys::ArrayBuffer>, JsValue>;
45    #[cfg(feature = "PushSubscriptionJson")]
46    #[wasm_bindgen(catch, method, js_class = "PushSubscription", js_name = "toJSON")]
47    #[doc = "The `toJSON()` method."]
48    #[doc = ""]
49    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/toJSON)"]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `PushSubscription`, `PushSubscriptionJson`*"]
52    pub fn to_json(this: &PushSubscription) -> Result<PushSubscriptionJson, JsValue>;
53    #[wasm_bindgen(catch, method, js_class = "PushSubscription")]
54    #[doc = "The `unsubscribe()` method."]
55    #[doc = ""]
56    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/unsubscribe)"]
57    #[doc = ""]
58    #[doc = "*This API requires the following crate features to be activated: `PushSubscription`*"]
59    pub fn unsubscribe(this: &PushSubscription) -> Result<::js_sys::Promise, JsValue>;
60}