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

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

Issue 15431003: Cleanup of various DOM dart2js and dart_analyzer warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/src/ImmutableListMixin.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 * 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void pause([Future resumeSignal]) { 71 void pause([Future resumeSignal]) {
72 if (_canceled) return; 72 if (_canceled) return;
73 ++_pauseCount; 73 ++_pauseCount;
74 _unlisten(); 74 _unlisten();
75 75
76 if (resumeSignal != null) { 76 if (resumeSignal != null) {
77 resumeSignal.whenComplete(resume); 77 resumeSignal.whenComplete(resume);
78 } 78 }
79 } 79 }
80 80
81 bool get _paused => _pauseCount > 0; 81 bool get isPaused => _pauseCount > 0;
82 82
83 void resume() { 83 void resume() {
84 if (_canceled || !_paused) return; 84 if (_canceled || !isPaused) return;
85 --_pauseCount; 85 --_pauseCount;
86 _tryResume(); 86 _tryResume();
87 } 87 }
88 88
89 void _tryResume() { 89 void _tryResume() {
90 if (_onData != null && !_paused) { 90 if (_onData != null && !isPaused) {
91 _target.$dom_addEventListener(_eventType, _onData, _useCapture); 91 _target.$dom_addEventListener(_eventType, _onData, _useCapture);
92 } 92 }
93 } 93 }
94 94
95 void _unlisten() { 95 void _unlisten() {
96 if (_onData != null) { 96 if (_onData != null) {
97 _target.$dom_removeEventListener(_eventType, _onData, _useCapture); 97 _target.$dom_removeEventListener(_eventType, _onData, _useCapture);
98 } 98 }
99 } 99 }
100 100
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const _CustomEventStreamProvider(this._eventTypeGetter); 156 const _CustomEventStreamProvider(this._eventTypeGetter);
157 157
158 Stream<T> forTarget(EventTarget e, {bool useCapture: false}) { 158 Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
159 return new _EventStream(e, _eventTypeGetter(e), useCapture); 159 return new _EventStream(e, _eventTypeGetter(e), useCapture);
160 } 160 }
161 161
162 String getEventType(EventTarget target) { 162 String getEventType(EventTarget target) {
163 return _eventTypeGetter(target); 163 return _eventTypeGetter(target);
164 } 164 }
165 } 165 }
OLDNEW
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tools/dom/src/ImmutableListMixin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698