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

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

Issue 2899173002: Include DDC fixes to dart:html in the main version (Closed)
Patch Set: A few more ddc fixes Created 3 years, 7 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
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 * 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // ? _wrapZone/*<Event, dynamic>*/(onData) 229 // ? _wrapZone/*<Event, dynamic>*/(onData)
230 // : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T)) 230 // : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
231 // In order to support existing tests which pass the wrong type of events but 231 // In order to support existing tests which pass the wrong type of events but
232 // use a more general listener, without causing as much slowdown for things 232 // use a more general listener, without causing as much slowdown for things
233 // which are typed correctly. But this currently runs afoul of restrictions 233 // which are typed correctly. But this currently runs afoul of restrictions
234 // on is checks for compatibility with the VM. 234 // on is checks for compatibility with the VM.
235 _EventStreamSubscription( 235 _EventStreamSubscription(
236 this._target, this._eventType, void onData(T event), this._useCapture) 236 this._target, this._eventType, void onData(T event), this._useCapture)
237 : _onData = onData == null 237 : _onData = onData == null
238 ? null 238 ? null
239 : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e)) { 239 : _wrapZone<Event, dynamic>((e) => (onData as dynamic)(e)) {
240 _tryResume(); 240 _tryResume();
241 } 241 }
242 242
243 Future cancel() { 243 Future cancel() {
244 if (_canceled) return null; 244 if (_canceled) return null;
245 245
246 _unlisten(); 246 _unlisten();
247 // Clear out the target to indicate this is complete. 247 // Clear out the target to indicate this is complete.
248 _target = null; 248 _target = null;
249 _onData = null; 249 _onData = null;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 e, _eventTypeGetter(e), useCapture); 438 e, _eventTypeGetter(e), useCapture);
439 } 439 }
440 440
441 String getEventType(EventTarget target) { 441 String getEventType(EventTarget target) {
442 return _eventTypeGetter(target); 442 return _eventTypeGetter(target);
443 } 443 }
444 444
445 String get _eventType => 445 String get _eventType =>
446 throw new UnsupportedError('Access type through getEventType method.'); 446 throw new UnsupportedError('Access type through getEventType method.');
447 } 447 }
OLDNEW
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/templates/html/impl/impl_EventTarget.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698