Skip to main content

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