-
Notifications
You must be signed in to change notification settings - Fork 24
/
events.dart
301 lines (211 loc) · 10.2 KB
/
events.dart
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
295
296
297
298
299
300
301
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import '../../dom.dart';
import 'providers.dart';
import 'streams.dart';
extension ElementEventGetters on Element {
ElementStream<Event> get onAbort =>
EventStreamProviders.abortEvent.forElement(this);
ElementStream<Event> get onBeforeCopy =>
EventStreamProviders.beforeCopyEvent.forElement(this);
ElementStream<Event> get onBeforeCut =>
EventStreamProviders.beforeCutEvent.forElement(this);
ElementStream<Event> get onBeforePaste =>
EventStreamProviders.beforePasteEvent.forElement(this);
ElementStream<Event> get onBlur =>
EventStreamProviders.blurEvent.forElement(this);
ElementStream<Event> get onCanPlay =>
EventStreamProviders.canPlayEvent.forElement(this);
ElementStream<Event> get onCanPlayThrough =>
EventStreamProviders.canPlayThroughEvent.forElement(this);
ElementStream<Event> get onChange =>
EventStreamProviders.changeEvent.forElement(this);
ElementStream<MouseEvent> get onClick =>
EventStreamProviders.clickEvent.forElement(this);
ElementStream<MouseEvent> get onContextMenu =>
EventStreamProviders.contextMenuEvent.forElement(this);
ElementStream<ClipboardEvent> get onCopy =>
EventStreamProviders.copyEvent.forElement(this);
ElementStream<ClipboardEvent> get onCut =>
EventStreamProviders.cutEvent.forElement(this);
ElementStream<Event> get onDoubleClick =>
EventStreamProviders.doubleClickElementEvent.forElement(this);
ElementStream<MouseEvent> get onDrag =>
EventStreamProviders.dragEvent.forElement(this);
ElementStream<MouseEvent> get onDragEnd =>
EventStreamProviders.dragEndEvent.forElement(this);
ElementStream<MouseEvent> get onDragEnter =>
EventStreamProviders.dragEnterEvent.forElement(this);
ElementStream<MouseEvent> get onDragLeave =>
EventStreamProviders.dragLeaveEvent.forElement(this);
ElementStream<MouseEvent> get onDragOver =>
EventStreamProviders.dragOverEvent.forElement(this);
ElementStream<MouseEvent> get onDragStart =>
EventStreamProviders.dragStartEvent.forElement(this);
ElementStream<MouseEvent> get onDrop =>
EventStreamProviders.dropEvent.forElement(this);
ElementStream<Event> get onDurationChange =>
EventStreamProviders.durationChangeEvent.forElement(this);
ElementStream<Event> get onEmptied =>
EventStreamProviders.emptiedEvent.forElement(this);
ElementStream<Event> get onEnded =>
EventStreamProviders.endedEvent.forElement(this);
ElementStream<Event> get onError =>
EventStreamProviders.errorElementEvent.forElement(this);
ElementStream<Event> get onFocus =>
EventStreamProviders.focusEvent.forElement(this);
ElementStream<Event> get onFullscreenChange =>
EventStreamProviders.fullscreenChangeEvent.forElement(this);
ElementStream<Event> get onFullscreenError =>
EventStreamProviders.fullscreenErrorEvent.forElement(this);
ElementStream<Event> get onInput =>
EventStreamProviders.inputEvent.forElement(this);
ElementStream<Event> get onInvalid =>
EventStreamProviders.invalidEvent.forElement(this);
ElementStream<KeyboardEvent> get onKeyDown =>
EventStreamProviders.keyDownEvent.forElement(this);
ElementStream<KeyboardEvent> get onKeyPress =>
EventStreamProviders.keyPressEvent.forElement(this);
ElementStream<KeyboardEvent> get onKeyUp =>
EventStreamProviders.keyUpEvent.forElement(this);
ElementStream<Event> get onLoad =>
EventStreamProviders.loadEvent.forElement(this);
ElementStream<Event> get onLoadedData =>
EventStreamProviders.loadedDataEvent.forElement(this);
ElementStream<Event> get onLoadedMetadata =>
EventStreamProviders.loadedMetadataEvent.forElement(this);
ElementStream<MouseEvent> get onMouseDown =>
EventStreamProviders.mouseDownEvent.forElement(this);
ElementStream<MouseEvent> get onMouseEnter =>
EventStreamProviders.mouseEnterEvent.forElement(this);
ElementStream<MouseEvent> get onMouseLeave =>
EventStreamProviders.mouseLeaveEvent.forElement(this);
ElementStream<MouseEvent> get onMouseMove =>
EventStreamProviders.mouseMoveEvent.forElement(this);
ElementStream<MouseEvent> get onMouseOut =>
EventStreamProviders.mouseOutEvent.forElement(this);
ElementStream<MouseEvent> get onMouseOver =>
EventStreamProviders.mouseOverEvent.forElement(this);
ElementStream<MouseEvent> get onMouseUp =>
EventStreamProviders.mouseUpEvent.forElement(this);
ElementStream<ClipboardEvent> get onPaste =>
EventStreamProviders.pasteEvent.forElement(this);
ElementStream<Event> get onPause =>
EventStreamProviders.pauseEvent.forElement(this);
ElementStream<Event> get onPlay =>
EventStreamProviders.playEvent.forElement(this);
ElementStream<Event> get onPlaying =>
EventStreamProviders.playingEvent.forElement(this);
ElementStream<Event> get onRateChange =>
EventStreamProviders.rateChangeEvent.forElement(this);
ElementStream<Event> get onReset =>
EventStreamProviders.resetEvent.forElement(this);
ElementStream<Event> get onResize =>
EventStreamProviders.resizeEvent.forElement(this);
ElementStream<Event> get onScroll =>
EventStreamProviders.scrollEvent.forElement(this);
ElementStream<Event> get onSearch =>
EventStreamProviders.searchEvent.forElement(this);
ElementStream<Event> get onSeeked =>
EventStreamProviders.seekedEvent.forElement(this);
ElementStream<Event> get onSeeking =>
EventStreamProviders.seekingEvent.forElement(this);
ElementStream<Event> get onSelect =>
EventStreamProviders.selectEvent.forElement(this);
ElementStream<Event> get onSelectStart =>
EventStreamProviders.selectStartEvent.forElement(this);
ElementStream<Event> get onStalled =>
EventStreamProviders.stalledEvent.forElement(this);
ElementStream<Event> get onSubmit =>
EventStreamProviders.submitEvent.forElement(this);
ElementStream<Event> get onSuspend =>
EventStreamProviders.suspendEvent.forElement(this);
ElementStream<Event> get onTimeUpdate =>
EventStreamProviders.timeUpdateEvent.forElement(this);
ElementStream<TouchEvent> get onTouchCancel =>
EventStreamProviders.touchCancelEvent.forElement(this);
ElementStream<TouchEvent> get onTouchEnd =>
EventStreamProviders.touchEndEvent.forElement(this);
ElementStream<TouchEvent> get onTouchEnter =>
EventStreamProviders.touchEnterEvent.forElement(this);
ElementStream<TouchEvent> get onTouchLeave =>
EventStreamProviders.touchLeaveEvent.forElement(this);
ElementStream<TouchEvent> get onTouchMove =>
EventStreamProviders.touchMoveEvent.forElement(this);
ElementStream<TouchEvent> get onTouchStart =>
EventStreamProviders.touchStartEvent.forElement(this);
ElementStream<Event> get onVolumeChange =>
EventStreamProviders.volumeChangeEvent.forElement(this);
ElementStream<Event> get onWaiting =>
EventStreamProviders.waitingEvent.forElement(this);
ElementStream<WebGLContextEvent> get onWebGlContextLost =>
EventStreamProviders.webGlContextLostEvent.forElement(this);
ElementStream<WebGLContextEvent> get onWebGlContextRestored =>
EventStreamProviders.webGlContextRestoredEvent.forElement(this);
ElementStream<WheelEvent> get onWheel =>
EventStreamProviders.wheelEvent.forElement(this);
}
extension XHRGetters on XMLHttpRequest {
Stream<ProgressEvent> get onLoad =>
EventStreamProviders.loadEvent.forTarget(this);
Stream<ProgressEvent> get onError =>
EventStreamProviders.errorEvent.forTarget(this);
Stream<ProgressEvent> get onProgress =>
EventStreamProviders.progressEvent.forTarget(this);
Stream<Event> get onReadyStateChange =>
EventStreamProviders.readyStateChangeEvent.forTarget(this);
}
extension EventSourceEventGetters on EventSource {
Stream<Event> get onError =>
EventStreamProviders.errorEventSourceEvent.forTarget(this);
Stream<MessageEvent> get onMessage =>
EventStreamProviders.messageEvent.forTarget(this);
Stream<Event> get onOpen => EventStreamProviders.openEvent.forTarget(this);
}
extension FileReaderEventGEtters on FileReader {
Stream<ProgressEvent> get onLoadEnd =>
EventStreamProviders.loadEndEvent.forTarget(this);
}
extension AutoElementEventGetters on AudioNode {
Stream<Event> get onEnded => EventStreamProviders.endedEvent.forTarget(this);
}
extension WindowEventGetters on Window {
Stream<KeyboardEvent> get onKeyDown =>
EventStreamProviders.keyDownEvent.forTarget(this);
Stream<TouchEvent> get onTouchMove =>
EventStreamProviders.touchMoveEvent.forTarget(this);
Stream<PopStateEvent> get onPopState =>
EventStreamProviders.popStateEvent.forTarget(this);
Stream<KeyboardEvent> get onKeyPress =>
EventStreamProviders.keyPressEvent.forTarget(this);
Stream<MessageEvent> get onMessage =>
EventStreamProviders.messageEvent.forTarget(this);
}
extension ElementCustomEvents on Element {
ElementStream<WheelEvent> get onMouseWheel =>
CustomEventProviders.mouseWheelEvent.forElement(this);
ElementStream<TransitionEvent> get onTransitionEnd =>
CustomEventProviders.transitionEndEvent.forElement(this);
}
extension DocumentCustomEvents on Document {
Stream<WheelEvent> get onMouseWheel =>
CustomEventProviders.mouseWheelEvent.forTarget(this);
Stream<Event> get onVisibilityChange =>
CustomEventProviders.visibilityChangeEvent.forTarget(this);
}
extension WindowCustomEvents on Window {
Stream<WheelEvent> get onMouseWheel =>
CustomEventProviders.mouseWheelEvent.forTarget(this);
Stream<TransitionEvent> get onTransitionEnd =>
CustomEventProviders.transitionEndEvent.forTarget(this);
}
extension WebSocketEvents on WebSocket {
Stream<Event> get onOpen => EventStreamProviders.openEvent.forTarget(this);
Stream<MessageEvent> get onMessage =>
EventStreamProviders.messageEvent.forTarget(this);
Stream<CloseEvent> get onClose =>
EventStreamProviders.closeEvent.forTarget(this);
Stream<Event> get onError =>
EventStreamProviders.errorEventSourceEvent.forTarget(this);
}