Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: tools/dom/src/EventStreamProvider.dart

Issue 11931009: Adding support for the MouseWheel event in Streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 * Adapter for exposing DOM events as Dart streams. 8 * Adapter for exposing DOM events as Dart streams.
9 */ 9 */
10 class _EventStream<T extends Event> extends Stream<T> { 10 class _EventStream<T extends Event> extends Stream<T> {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * MediaElement.pauseEvent.forTarget(document.body).listen(...); 128 * MediaElement.pauseEvent.forTarget(document.body).listen(...);
129 * 129 *
130 * See also: 130 * See also:
131 * 131 *
132 * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventLis tener) 132 * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventLis tener)
133 */ 133 */
134 Stream<T> forTarget(EventTarget e, {bool useCapture: false}) { 134 Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
135 return new _EventStream(e, _eventType, useCapture); 135 return new _EventStream(e, _eventType, useCapture);
136 } 136 }
137 } 137 }
138
139 /**
140 * A factory to expose DOM events as streams, where the DOM event name has to
141 * be determined on the fly (for example, mouse wheel events).
142 */
143 class _CustomEventStreamProvider<T extends Event>
144 implements EventStreamProvider<T> {
145
146 final _eventTypeGetter;
147 const _CustomEventStreamProvider(this._eventTypeGetter);
148
149 Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
150 return new _EventStream(e, _eventTypeGetter(e), useCapture);
151 }
152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698