1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
use super::*;
/// The UIEvent class.
/// [`UIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct UIEvent {
inner: Event,
}
impl FromVal for UIEvent {
fn from_val(v: &Any) -> Self {
UIEvent {
inner: Event::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for UIEvent {
type Target = Event;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for UIEvent {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for UIEvent {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for UIEvent {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<UIEvent> for Any {
fn from(s: UIEvent) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&UIEvent> for Any {
fn from(s: &UIEvent) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(UIEvent);
impl UIEvent {
/// Getter of the `view` attribute.
/// [`UIEvent.view`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view)
pub fn view(&self) -> Window {
self.inner.get("view").as_::<Window>()
}
}
impl UIEvent {
/// Getter of the `detail` attribute.
/// [`UIEvent.detail`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail)
pub fn detail(&self) -> i32 {
self.inner.get("detail").as_::<i32>()
}
}
impl UIEvent {
/// Getter of the `sourceCapabilities` attribute.
/// [`UIEvent.sourceCapabilities`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/sourceCapabilities)
pub fn source_capabilities(&self) -> InputDeviceCapabilities {
self.inner
.get("sourceCapabilities")
.as_::<InputDeviceCapabilities>()
}
}
impl UIEvent {
/// Getter of the `which` attribute.
/// [`UIEvent.which`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which)
pub fn which(&self) -> u32 {
self.inner.get("which").as_::<u32>()
}
}
impl UIEvent {
/// The `new UIEvent(..)` constructor, creating a new UIEvent instance
pub fn new(type_: &JsString) -> UIEvent {
Self {
inner: Any::global("UIEvent").new(&[type_.into()]).as_::<Event>(),
}
}
}
impl UIEvent {
/// The `new UIEvent(..)` constructor, creating a new UIEvent instance
pub fn new_with_event_init_dict(type_: &JsString, event_init_dict: &UIEventInit) -> UIEvent {
Self {
inner: Any::global("UIEvent")
.new(&[type_.into(), event_init_dict.into()])
.as_::<Event>(),
}
}
}
impl UIEvent {
/// The initUIEvent method.
/// [`UIEvent.initUIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/initUIEvent)
pub fn init_ui_event(&self, type_arg: &JsString) -> Undefined {
self.inner
.call("initUIEvent", &[type_arg.into()])
.as_::<Undefined>()
}
}
impl UIEvent {
/// The initUIEvent method.
/// [`UIEvent.initUIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/initUIEvent)
pub fn init_ui_event_with_bubbles_arg(
&self,
type_arg: &JsString,
bubbles_arg: bool,
) -> Undefined {
self.inner
.call("initUIEvent", &[type_arg.into(), bubbles_arg.into()])
.as_::<Undefined>()
}
}
impl UIEvent {
/// The initUIEvent method.
/// [`UIEvent.initUIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/initUIEvent)
pub fn init_ui_event_with_bubbles_arg_and_cancelable_arg(
&self,
type_arg: &JsString,
bubbles_arg: bool,
cancelable_arg: bool,
) -> Undefined {
self.inner
.call(
"initUIEvent",
&[type_arg.into(), bubbles_arg.into(), cancelable_arg.into()],
)
.as_::<Undefined>()
}
}
impl UIEvent {
/// The initUIEvent method.
/// [`UIEvent.initUIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/initUIEvent)
pub fn init_ui_event_with_bubbles_arg_and_cancelable_arg_and_view_arg(
&self,
type_arg: &JsString,
bubbles_arg: bool,
cancelable_arg: bool,
view_arg: &Window,
) -> Undefined {
self.inner
.call(
"initUIEvent",
&[
type_arg.into(),
bubbles_arg.into(),
cancelable_arg.into(),
view_arg.into(),
],
)
.as_::<Undefined>()
}
}
impl UIEvent {
/// The initUIEvent method.
/// [`UIEvent.initUIEvent`](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/initUIEvent)
pub fn init_ui_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_detail_arg(
&self,
type_arg: &JsString,
bubbles_arg: bool,
cancelable_arg: bool,
view_arg: &Window,
detail_arg: i32,
) -> Undefined {
self.inner
.call(
"initUIEvent",
&[
type_arg.into(),
bubbles_arg.into(),
cancelable_arg.into(),
view_arg.into(),
detail_arg.into(),
],
)
.as_::<Undefined>()
}
}