OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of html; | 5 part of html; |
6 | 6 |
7 /** | 7 /** |
8 * A factory to expose DOM events as Streams. | 8 * A factory to expose DOM events as Streams. |
9 */ | 9 */ |
10 class EventStreamProvider<T extends Event> { | 10 class EventStreamProvider<T extends Event> { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 /** | 105 /** |
106 * Adds a capturing subscription to this stream. | 106 * Adds a capturing subscription to this stream. |
107 * | 107 * |
108 * If the target of the event is a descendant of the element from which this | 108 * If the target of the event is a descendant of the element from which this |
109 * stream derives then [onData] is called before the event propagates down to | 109 * stream derives then [onData] is called before the event propagates down to |
110 * the target. This is the opposite of bubbling behavior, where the event | 110 * the target. This is the opposite of bubbling behavior, where the event |
111 * is first processed for the event target and then bubbles upward. | 111 * is first processed for the event target and then bubbles upward. |
112 * | 112 * |
113 * ## Other resources | 113 * ## Other resources |
114 * | 114 * |
115 * * [Event Capture] | 115 * * [Event Capture](http://www.w3.org/TR/DOM-Level-2-Events/events.html#Event
s-flow-capture) |
116 * (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-capture) | 116 * from the W3C DOM Events specification. |
117 * from the W3C DOM Events specification. | |
118 */ | 117 */ |
119 StreamSubscription<T> capture(void onData(T event)); | 118 StreamSubscription<T> capture(void onData(T event)); |
120 } | 119 } |
121 | 120 |
122 /** | 121 /** |
123 * Adapter for exposing DOM events as Dart streams. | 122 * Adapter for exposing DOM events as Dart streams. |
124 */ | 123 */ |
125 class _EventStream<T extends Event> extends Stream<T> { | 124 class _EventStream<T extends Event> extends Stream<T> { |
126 final EventTarget _target; | 125 final EventTarget _target; |
127 final String _eventType; | 126 final String _eventType; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture); | 424 return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture); |
426 } | 425 } |
427 | 426 |
428 String getEventType(EventTarget target) { | 427 String getEventType(EventTarget target) { |
429 return _eventTypeGetter(target); | 428 return _eventTypeGetter(target); |
430 } | 429 } |
431 | 430 |
432 String get _eventType => | 431 String get _eventType => |
433 throw new UnsupportedError('Access type through getEventType method.'); | 432 throw new UnsupportedError('Access type through getEventType method.'); |
434 } | 433 } |
OLD | NEW |