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