OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart.async; | 5 part of dart.async; |
6 | 6 |
7 /** Abstract and private interface for a place to put events. */ | 7 /** Abstract and private interface for a place to put events. */ |
8 abstract class _EventSink<T> { | 8 abstract class _EventSink<T> { |
9 void _add(T data); | 9 void _add(T data); |
10 void _addError(Object error, StackTrace stackTrace); | 10 void _addError(Object error, StackTrace stackTrace); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 void onData(void handleData(T event)) { | 139 void onData(void handleData(T event)) { |
140 if (handleData == null) handleData = _nullDataHandler; | 140 if (handleData == null) handleData = _nullDataHandler; |
141 // TODO(floitsch): the return type should be 'void', and the type | 141 // TODO(floitsch): the return type should be 'void', and the type |
142 // should be inferred. | 142 // should be inferred. |
143 _onData = _zone.registerUnaryCallback/*<dynamic, T>*/(handleData); | 143 _onData = _zone.registerUnaryCallback/*<dynamic, T>*/(handleData); |
144 } | 144 } |
145 | 145 |
146 void onError(Function handleError) { | 146 void onError(Function handleError) { |
147 if (handleError == null) handleError = _nullErrorHandler; | 147 if (handleError == null) handleError = _nullErrorHandler; |
148 _onError = _registerErrorHandler/*<T>*/(handleError, _zone); | 148 _onError = _registerErrorHandler/*<dynamic/*void*/>*/(handleError, _zone); |
Lasse Reichstein Nielsen
2016/05/09 15:43:03
I need documentation for this comment.
It's mean
floitsch
2016/05/09 16:53:55
You mean, there is too much comment?
Do you prefer
Lasse Reichstein Nielsen
2016/05/09 18:56:10
I just don't know what it means.
I have learned th
floitsch
2016/05/09 20:59:19
The /*void*/ is just a comment. It means that I wo
Lasse Reichstein Nielsen
2016/05/10 05:31:46
I think so, yes. It's confusing to have a comment
floitsch
2016/05/10 18:29:49
Done.
| |
149 } | 149 } |
150 | 150 |
151 void onDone(void handleDone()) { | 151 void onDone(void handleDone()) { |
152 if (handleDone == null) handleDone = _nullDoneHandler; | 152 if (handleDone == null) handleDone = _nullDoneHandler; |
153 _onDone = _zone.registerCallback(handleDone); | 153 _onDone = _zone.registerCallback(handleDone); |
154 } | 154 } |
155 | 155 |
156 void pause([Future resumeSignal]) { | 156 void pause([Future resumeSignal]) { |
157 if (_isCanceled) return; | 157 if (_isCanceled) return; |
158 bool wasPaused = _isPaused; | 158 bool wasPaused = _isPaused; |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1087 class _EmptyStream<T> extends Stream<T> { | 1087 class _EmptyStream<T> extends Stream<T> { |
1088 const _EmptyStream() : super._internal(); | 1088 const _EmptyStream() : super._internal(); |
1089 bool get isBroadcast => true; | 1089 bool get isBroadcast => true; |
1090 StreamSubscription<T> listen(void onData(T data), | 1090 StreamSubscription<T> listen(void onData(T data), |
1091 {Function onError, | 1091 {Function onError, |
1092 void onDone(), | 1092 void onDone(), |
1093 bool cancelOnError}) { | 1093 bool cancelOnError}) { |
1094 return new _DoneStreamSubscription<T>(onDone); | 1094 return new _DoneStreamSubscription<T>(onDone); |
1095 } | 1095 } |
1096 } | 1096 } |
OLD | NEW |