web_sys/features/
gen_Event.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Event , typescript_type = "Event")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `Event` class."]
10    #[doc = ""]
11    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event)"]
12    #[doc = ""]
13    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
14    pub type Event;
15    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = type)]
16    #[doc = "Getter for the `type` field of this object."]
17    #[doc = ""]
18    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/type)"]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
21    pub fn type_(this: &Event) -> ::alloc::string::String;
22    #[cfg(feature = "EventTarget")]
23    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = target)]
24    #[doc = "Getter for the `target` field of this object."]
25    #[doc = ""]
26    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/target)"]
27    #[doc = ""]
28    #[doc = "*This API requires the following crate features to be activated: `Event`, `EventTarget`*"]
29    pub fn target(this: &Event) -> Option<EventTarget>;
30    #[cfg(feature = "EventTarget")]
31    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = currentTarget)]
32    #[doc = "Getter for the `currentTarget` field of this object."]
33    #[doc = ""]
34    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget)"]
35    #[doc = ""]
36    #[doc = "*This API requires the following crate features to be activated: `Event`, `EventTarget`*"]
37    pub fn current_target(this: &Event) -> Option<EventTarget>;
38    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = eventPhase)]
39    #[doc = "Getter for the `eventPhase` field of this object."]
40    #[doc = ""]
41    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase)"]
42    #[doc = ""]
43    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
44    pub fn event_phase(this: &Event) -> u16;
45    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = bubbles)]
46    #[doc = "Getter for the `bubbles` field of this object."]
47    #[doc = ""]
48    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles)"]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
51    pub fn bubbles(this: &Event) -> bool;
52    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = cancelable)]
53    #[doc = "Getter for the `cancelable` field of this object."]
54    #[doc = ""]
55    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable)"]
56    #[doc = ""]
57    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
58    pub fn cancelable(this: &Event) -> bool;
59    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = defaultPrevented)]
60    #[doc = "Getter for the `defaultPrevented` field of this object."]
61    #[doc = ""]
62    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented)"]
63    #[doc = ""]
64    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
65    pub fn default_prevented(this: &Event) -> bool;
66    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = composed)]
67    #[doc = "Getter for the `composed` field of this object."]
68    #[doc = ""]
69    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/composed)"]
70    #[doc = ""]
71    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
72    pub fn composed(this: &Event) -> bool;
73    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = isTrusted)]
74    #[doc = "Getter for the `isTrusted` field of this object."]
75    #[doc = ""]
76    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted)"]
77    #[doc = ""]
78    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
79    pub fn is_trusted(this: &Event) -> bool;
80    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = timeStamp)]
81    #[doc = "Getter for the `timeStamp` field of this object."]
82    #[doc = ""]
83    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp)"]
84    #[doc = ""]
85    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
86    pub fn time_stamp(this: &Event) -> f64;
87    # [wasm_bindgen (structural , method , getter , js_class = "Event" , js_name = cancelBubble)]
88    #[doc = "Getter for the `cancelBubble` field of this object."]
89    #[doc = ""]
90    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble)"]
91    #[doc = ""]
92    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
93    pub fn cancel_bubble(this: &Event) -> bool;
94    # [wasm_bindgen (structural , method , setter , js_class = "Event" , js_name = cancelBubble)]
95    #[doc = "Setter for the `cancelBubble` field of this object."]
96    #[doc = ""]
97    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble)"]
98    #[doc = ""]
99    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
100    pub fn set_cancel_bubble(this: &Event, value: bool);
101    #[wasm_bindgen(catch, constructor, js_class = "Event")]
102    #[doc = "The `new Event(..)` constructor, creating a new instance of `Event`."]
103    #[doc = ""]
104    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)"]
105    #[doc = ""]
106    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
107    pub fn new(type_: &str) -> Result<Event, JsValue>;
108    #[cfg(feature = "EventInit")]
109    #[wasm_bindgen(catch, constructor, js_class = "Event")]
110    #[doc = "The `new Event(..)` constructor, creating a new instance of `Event`."]
111    #[doc = ""]
112    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)"]
113    #[doc = ""]
114    #[doc = "*This API requires the following crate features to be activated: `Event`, `EventInit`*"]
115    pub fn new_with_event_init_dict(
116        type_: &str,
117        event_init_dict: &EventInit,
118    ) -> Result<Event, JsValue>;
119    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = composedPath)]
120    #[doc = "The `composedPath()` method."]
121    #[doc = ""]
122    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath)"]
123    #[doc = ""]
124    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
125    pub fn composed_path(this: &Event) -> ::js_sys::Array;
126    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = initEvent)]
127    #[doc = "The `initEvent()` method."]
128    #[doc = ""]
129    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/initEvent)"]
130    #[doc = ""]
131    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
132    pub fn init_event(this: &Event, type_: &str);
133    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = initEvent)]
134    #[doc = "The `initEvent()` method."]
135    #[doc = ""]
136    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/initEvent)"]
137    #[doc = ""]
138    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
139    pub fn init_event_with_bubbles(this: &Event, type_: &str, bubbles: bool);
140    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = initEvent)]
141    #[doc = "The `initEvent()` method."]
142    #[doc = ""]
143    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/initEvent)"]
144    #[doc = ""]
145    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
146    pub fn init_event_with_bubbles_and_cancelable(
147        this: &Event,
148        type_: &str,
149        bubbles: bool,
150        cancelable: bool,
151    );
152    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = preventDefault)]
153    #[doc = "The `preventDefault()` method."]
154    #[doc = ""]
155    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)"]
156    #[doc = ""]
157    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
158    pub fn prevent_default(this: &Event);
159    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = stopImmediatePropagation)]
160    #[doc = "The `stopImmediatePropagation()` method."]
161    #[doc = ""]
162    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation)"]
163    #[doc = ""]
164    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
165    pub fn stop_immediate_propagation(this: &Event);
166    # [wasm_bindgen (method , structural , js_class = "Event" , js_name = stopPropagation)]
167    #[doc = "The `stopPropagation()` method."]
168    #[doc = ""]
169    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation)"]
170    #[doc = ""]
171    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
172    pub fn stop_propagation(this: &Event);
173}
174impl Event {
175    #[doc = "The `Event.NONE` const."]
176    #[doc = ""]
177    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
178    pub const NONE: u16 = 0i64 as u16;
179    #[doc = "The `Event.CAPTURING_PHASE` const."]
180    #[doc = ""]
181    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
182    pub const CAPTURING_PHASE: u16 = 1u64 as u16;
183    #[doc = "The `Event.AT_TARGET` const."]
184    #[doc = ""]
185    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
186    pub const AT_TARGET: u16 = 2u64 as u16;
187    #[doc = "The `Event.BUBBLING_PHASE` const."]
188    #[doc = ""]
189    #[doc = "*This API requires the following crate features to be activated: `Event`*"]
190    pub const BUBBLING_PHASE: u16 = 3u64 as u16;
191}