Chromium Code Reviews| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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)) { |
|
vsm
2017/05/24 13:11:49
Feel free to skip for this CL as it's nothing you'
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |