web_sys/features/
gen_EventSource.rs

1#![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 = EventSource , typescript_type = "EventSource")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `EventSource` class."]
10    #[doc = ""]
11    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)"]
12    #[doc = ""]
13    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
14    pub type EventSource;
15    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = url)]
16    #[doc = "Getter for the `url` field of this object."]
17    #[doc = ""]
18    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/url)"]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
21    pub fn url(this: &EventSource) -> ::alloc::string::String;
22    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = withCredentials)]
23    #[doc = "Getter for the `withCredentials` field of this object."]
24    #[doc = ""]
25    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/withCredentials)"]
26    #[doc = ""]
27    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
28    pub fn with_credentials(this: &EventSource) -> bool;
29    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = readyState)]
30    #[doc = "Getter for the `readyState` field of this object."]
31    #[doc = ""]
32    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/readyState)"]
33    #[doc = ""]
34    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
35    pub fn ready_state(this: &EventSource) -> u16;
36    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = onopen)]
37    #[doc = "Getter for the `onopen` field of this object."]
38    #[doc = ""]
39    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onopen)"]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
42    pub fn onopen(this: &EventSource) -> Option<::js_sys::Function>;
43    # [wasm_bindgen (structural , method , setter , js_class = "EventSource" , js_name = onopen)]
44    #[doc = "Setter for the `onopen` field of this object."]
45    #[doc = ""]
46    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onopen)"]
47    #[doc = ""]
48    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
49    pub fn set_onopen(this: &EventSource, value: Option<&::js_sys::Function>);
50    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = onmessage)]
51    #[doc = "Getter for the `onmessage` field of this object."]
52    #[doc = ""]
53    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onmessage)"]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
56    pub fn onmessage(this: &EventSource) -> Option<::js_sys::Function>;
57    # [wasm_bindgen (structural , method , setter , js_class = "EventSource" , js_name = onmessage)]
58    #[doc = "Setter for the `onmessage` field of this object."]
59    #[doc = ""]
60    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onmessage)"]
61    #[doc = ""]
62    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
63    pub fn set_onmessage(this: &EventSource, value: Option<&::js_sys::Function>);
64    # [wasm_bindgen (structural , method , getter , js_class = "EventSource" , js_name = onerror)]
65    #[doc = "Getter for the `onerror` field of this object."]
66    #[doc = ""]
67    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onerror)"]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
70    pub fn onerror(this: &EventSource) -> Option<::js_sys::Function>;
71    # [wasm_bindgen (structural , method , setter , js_class = "EventSource" , js_name = onerror)]
72    #[doc = "Setter for the `onerror` field of this object."]
73    #[doc = ""]
74    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/onerror)"]
75    #[doc = ""]
76    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
77    pub fn set_onerror(this: &EventSource, value: Option<&::js_sys::Function>);
78    #[wasm_bindgen(catch, constructor, js_class = "EventSource")]
79    #[doc = "The `new EventSource(..)` constructor, creating a new instance of `EventSource`."]
80    #[doc = ""]
81    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource)"]
82    #[doc = ""]
83    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
84    pub fn new(url: &str) -> Result<EventSource, JsValue>;
85    #[cfg(feature = "EventSourceInit")]
86    #[wasm_bindgen(catch, constructor, js_class = "EventSource")]
87    #[doc = "The `new EventSource(..)` constructor, creating a new instance of `EventSource`."]
88    #[doc = ""]
89    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource)"]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `EventSource`, `EventSourceInit`*"]
92    pub fn new_with_event_source_init_dict(
93        url: &str,
94        event_source_init_dict: &EventSourceInit,
95    ) -> Result<EventSource, JsValue>;
96    # [wasm_bindgen (method , structural , js_class = "EventSource" , js_name = close)]
97    #[doc = "The `close()` method."]
98    #[doc = ""]
99    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/close)"]
100    #[doc = ""]
101    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
102    pub fn close(this: &EventSource);
103}
104impl EventSource {
105    #[doc = "The `EventSource.CONNECTING` const."]
106    #[doc = ""]
107    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
108    pub const CONNECTING: u16 = 0i64 as u16;
109    #[doc = "The `EventSource.OPEN` const."]
110    #[doc = ""]
111    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
112    pub const OPEN: u16 = 1u64 as u16;
113    #[doc = "The `EventSource.CLOSED` const."]
114    #[doc = ""]
115    #[doc = "*This API requires the following crate features to be activated: `EventSource`*"]
116    pub const CLOSED: u16 = 2u64 as u16;
117}