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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
use crate::event::{
    OnAnimationCancel, OnAnimationEnd, OnAnimationIteration, OnAnimationStart, OnBlur, OnChange,
    OnClick, OnContextMenu, OnDoubleClick, OnDrag, OnDragEnd, OnDragEnter, OnDragLeave, OnDragOver,
    OnDragStart, OnDrop, OnDurationChanged, OnEmptied, OnEnded, OnError, OnFocus,
    OnGotPointerCapture, OnInput, OnInvalid, OnKeyDown, OnKeyUp, OnLoad, OnLoadEnd, OnLoadStart,
    OnLoadedData, OnLoadedMetadata, OnLostPointerCapture, OnMouseDown, OnMouseEnter, OnMouseLeave,
    OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnPause, OnPlay, OnPlaying, OnPointerCancel,
    OnPointerDown, OnPointerEnter, OnPointerLeave, OnPointerMove, OnPointerOut, OnPointerOver,
    OnPointerUp, OnProgress, OnRateChange, OnReset, OnResize, OnScroll, OnSeeked, OnSeeking,
    OnSelect, OnStalled, OnSubmit, OnSuspend, OnTimeUpdate, OnToggle, OnTransitionCancel,
    OnTransitionEnd, OnTransitionRun, OnTransitionStart, OnVolumeChange, OnWaiting, OnWheel,
};

pub trait GlobalEventHandlers: AsRef<web_sys::EventTarget> {
    fn on_blur(&self) -> OnBlur {
        OnBlur::new(self.as_ref().clone().into())
    }

    fn on_focus(&self) -> OnFocus {
        OnFocus::new(self.as_ref().clone().into())
    }

    fn on_change(&self) -> OnChange {
        OnChange::new(self.as_ref().clone().into())
    }

    fn on_click(&self) -> OnClick {
        OnClick::new(self.as_ref().clone().into())
    }

    fn on_context_menu(&self) -> OnContextMenu {
        OnContextMenu::new(self.as_ref().clone().into())
    }

    fn on_double_click(&self) -> OnDoubleClick {
        OnDoubleClick::new(self.as_ref().clone().into())
    }

    fn on_drag(&self) -> OnDrag {
        OnDrag::new(self.as_ref().clone().into())
    }

    fn on_drag_end(&self) -> OnDragEnd {
        OnDragEnd::new(self.as_ref().clone().into())
    }

    fn on_drag_enter(&self) -> OnDragEnter {
        OnDragEnter::new(self.as_ref().clone().into())
    }

    fn on_drag_leave(&self) -> OnDragLeave {
        OnDragLeave::new(self.as_ref().clone().into())
    }

    fn on_drag_over(&self) -> OnDragOver {
        OnDragOver::new(self.as_ref().clone().into())
    }

    fn on_drag_start(&self) -> OnDragStart {
        OnDragStart::new(self.as_ref().clone().into())
    }

    fn on_drop(&self) -> OnDrop {
        OnDrop::new(self.as_ref().clone().into())
    }

    fn on_input(&self) -> OnInput {
        OnInput::new(self.as_ref().clone().into())
    }

    fn on_invalid(&self) -> OnInvalid {
        OnInvalid::new(self.as_ref().clone().into())
    }

    fn on_key_down(&self) -> OnKeyDown {
        OnKeyDown::new(self.as_ref().clone().into())
    }

    fn on_key_up(&self) -> OnKeyUp {
        OnKeyUp::new(self.as_ref().clone().into())
    }

    fn on_load(&self) -> OnLoad {
        OnLoad::new(self.as_ref().clone().into())
    }

    fn on_load_start(&self) -> OnLoadStart {
        OnLoadStart::new(self.as_ref().clone().into())
    }

    fn on_load_end(&self) -> OnLoadEnd {
        OnLoadEnd::new(self.as_ref().clone().into())
    }

    fn on_progress(&self) -> OnProgress {
        OnProgress::new(self.as_ref().clone().into())
    }

    fn on_mouse_down(&self) -> OnMouseDown {
        OnMouseDown::new(self.as_ref().clone().into())
    }

    fn on_mouse_enter(&self) -> OnMouseEnter {
        OnMouseEnter::new(self.as_ref().clone().into())
    }

    fn on_mouse_leave(&self) -> OnMouseLeave {
        OnMouseLeave::new(self.as_ref().clone().into())
    }

    fn on_mouse_move(&self) -> OnMouseMove {
        OnMouseMove::new(self.as_ref().clone().into())
    }

    fn on_mouse_out(&self) -> OnMouseOut {
        OnMouseOut::new(self.as_ref().clone().into())
    }

    fn on_mouse_over(&self) -> OnMouseOver {
        OnMouseOver::new(self.as_ref().clone().into())
    }

    fn on_mouse_up(&self) -> OnMouseUp {
        OnMouseUp::new(self.as_ref().clone().into())
    }

    fn on_wheel(&self) -> OnWheel {
        OnWheel::new(self.as_ref().clone().into())
    }

    fn on_reset(&self) -> OnReset {
        OnReset::new(self.as_ref().clone().into())
    }

    fn on_resize(&self) -> OnResize {
        OnResize::new(self.as_ref().clone().into())
    }

    fn on_scroll(&self) -> OnScroll {
        OnScroll::new(self.as_ref().clone().into())
    }

    fn on_select(&self) -> OnSelect {
        OnSelect::new(self.as_ref().clone().into())
    }

    fn on_submit(&self) -> OnSubmit {
        OnSubmit::new(self.as_ref().clone().into())
    }

    fn on_toggle(&self) -> OnToggle {
        OnToggle::new(self.as_ref().clone().into())
    }

    fn on_pointer_cancel(&self) -> OnPointerCancel {
        OnPointerCancel::new(self.as_ref().clone().into())
    }

    fn on_pointer_down(&self) -> OnPointerDown {
        OnPointerDown::new(self.as_ref().clone().into())
    }

    fn on_pointer_move(&self) -> OnPointerMove {
        OnPointerMove::new(self.as_ref().clone().into())
    }

    fn on_pointer_up(&self) -> OnPointerUp {
        OnPointerUp::new(self.as_ref().clone().into())
    }

    fn on_pointer_out(&self) -> OnPointerOut {
        OnPointerOut::new(self.as_ref().clone().into())
    }

    fn on_pointer_over(&self) -> OnPointerOver {
        OnPointerOver::new(self.as_ref().clone().into())
    }

    fn on_pointer_enter(&self) -> OnPointerEnter {
        OnPointerEnter::new(self.as_ref().clone().into())
    }

    fn on_pointer_leave(&self) -> OnPointerLeave {
        OnPointerLeave::new(self.as_ref().clone().into())
    }

    fn on_got_pointer_capture(&self) -> OnGotPointerCapture {
        OnGotPointerCapture::new(self.as_ref().clone().into())
    }

    fn on_lost_pointer_capture(&self) -> OnLostPointerCapture {
        OnLostPointerCapture::new(self.as_ref().clone().into())
    }

    fn on_animation_cancel(&self) -> OnAnimationCancel {
        OnAnimationCancel::new(self.as_ref().clone().into())
    }

    fn on_animation_end(&self) -> OnAnimationEnd {
        OnAnimationEnd::new(self.as_ref().clone().into())
    }

    fn on_animation_iteration(&self) -> OnAnimationIteration {
        OnAnimationIteration::new(self.as_ref().clone().into())
    }

    fn on_animation_start(&self) -> OnAnimationStart {
        OnAnimationStart::new(self.as_ref().clone().into())
    }

    fn on_transition_cancel(&self) -> OnTransitionCancel {
        OnTransitionCancel::new(self.as_ref().clone().into())
    }

    fn on_transition_end(&self) -> OnTransitionEnd {
        OnTransitionEnd::new(self.as_ref().clone().into())
    }

    fn on_transition_run(&self) -> OnTransitionRun {
        OnTransitionRun::new(self.as_ref().clone().into())
    }

    fn on_transition_start(&self) -> OnTransitionStart {
        OnTransitionStart::new(self.as_ref().clone().into())
    }

    fn on_error(&self) -> OnError {
        OnError::new(self.as_ref().clone().into())
    }

    fn on_duration_changed(&self) -> OnDurationChanged {
        OnDurationChanged::new(self.as_ref().clone().into())
    }

    fn on_emptied(&self) -> OnEmptied {
        OnEmptied::new(self.as_ref().clone().into())
    }

    fn on_ended(&self) -> OnEnded {
        OnEnded::new(self.as_ref().clone().into())
    }

    fn on_loaded_data(&self) -> OnLoadedData {
        OnLoadedData::new(self.as_ref().clone().into())
    }

    fn on_loaded_metadata(&self) -> OnLoadedMetadata {
        OnLoadedMetadata::new(self.as_ref().clone().into())
    }

    fn on_pause(&self) -> OnPause {
        OnPause::new(self.as_ref().clone().into())
    }

    fn on_play(&self) -> OnPlay {
        OnPlay::new(self.as_ref().clone().into())
    }

    fn on_playing(&self) -> OnPlaying {
        OnPlaying::new(self.as_ref().clone().into())
    }

    fn on_rate_change(&self) -> OnRateChange {
        OnRateChange::new(self.as_ref().clone().into())
    }

    fn on_seeked(&self) -> OnSeeked {
        OnSeeked::new(self.as_ref().clone().into())
    }

    fn on_seeking(&self) -> OnSeeking {
        OnSeeking::new(self.as_ref().clone().into())
    }

    fn on_stalled(&self) -> OnStalled {
        OnStalled::new(self.as_ref().clone().into())
    }

    fn on_suspend(&self) -> OnSuspend {
        OnSuspend::new(self.as_ref().clone().into())
    }

    fn on_time_update(&self) -> OnTimeUpdate {
        OnTimeUpdate::new(self.as_ref().clone().into())
    }

    fn on_volume_change(&self) -> OnVolumeChange {
        OnVolumeChange::new(self.as_ref().clone().into())
    }

    fn on_waiting(&self) -> OnWaiting {
        OnWaiting::new(self.as_ref().clone().into())
    }
}