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

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

Issue 143363011: First pass at cleaning up html lib warnings from the analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
« no previous file with comments | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/dom/src/KeyboardEventStream.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 EventTarget _target; 216 EventTarget _target;
217 final String _eventType; 217 final String _eventType;
218 var _onData; 218 var _onData;
219 final bool _useCapture; 219 final bool _useCapture;
220 220
221 _EventStreamSubscription(this._target, this._eventType, onData, 221 _EventStreamSubscription(this._target, this._eventType, onData,
222 this._useCapture) : _onData = _wrapZone(onData) { 222 this._useCapture) : _onData = _wrapZone(onData) {
223 _tryResume(); 223 _tryResume();
224 } 224 }
225 225
226 void cancel() { 226 Future cancel() {
227 if (_canceled) return; 227 if (_canceled) return null;
228 228
229 _unlisten(); 229 _unlisten();
230 // Clear out the target to indicate this is complete. 230 // Clear out the target to indicate this is complete.
231 _target = null; 231 _target = null;
232 _onData = null; 232 _onData = null;
233 return null;
233 } 234 }
234 235
235 bool get _canceled => _target == null; 236 bool get _canceled => _target == null;
236 237
237 void onData(void handleData(T event)) { 238 void onData(void handleData(T event)) {
238 if (_canceled) { 239 if (_canceled) {
239 throw new StateError("Subscription has been canceled."); 240 throw new StateError("Subscription has been canceled.");
240 } 241 }
241 // Remove current event listener. 242 // Remove current event listener.
242 _unlisten(); 243 _unlisten();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 422
422 ElementStream<T> _forElementList(ElementList e, 423 ElementStream<T> _forElementList(ElementList e,
423 {bool useCapture: false}) { 424 {bool useCapture: false}) {
424 return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture); 425 return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture);
425 } 426 }
426 427
427 String getEventType(EventTarget target) { 428 String getEventType(EventTarget target) {
428 return _eventTypeGetter(target); 429 return _eventTypeGetter(target);
429 } 430 }
430 } 431 }
OLDNEW
« no previous file with comments | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/dom/src/KeyboardEventStream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698