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 dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
| 8 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 }, | 492 }, |
| 493 onError: future._setError, | 493 onError: future._setError, |
| 494 onDone: () { | 494 onDone: () { |
| 495 future._setValue(result); | 495 future._setValue(result); |
| 496 }, | 496 }, |
| 497 cancelOnError: true); | 497 cancelOnError: true); |
| 498 return future; | 498 return future; |
| 499 } | 499 } |
| 500 | 500 |
| 501 /** | 501 /** |
| 502 * Discard all data on the stream, but signal when it's done or an error | |
| 503 * occoured. | |
|
floitsch
2013/05/24 11:50:42
Discards ... signals ... occured
Add optional arg
Anders Johnsen
2013/05/24 12:45:03
Done.
| |
| 504 */ | |
| 505 Future drain() => listen(null).asFuture(); | |
|
floitsch
2013/05/24 11:50:42
list(null, cancelOnError: true), documenting that
Anders Johnsen
2013/05/24 12:45:03
Done.
Søren Gjesse
2013/05/24 14:02:04
Should it maybe have a named optional argument "ig
floitsch
2013/05/24 16:21:33
I think that this should be kept as simple as poss
| |
| 506 | |
| 507 /** | |
| 502 * Provides at most the first [n] values of this stream. | 508 * Provides at most the first [n] values of this stream. |
| 503 * | 509 * |
| 504 * Forwards the first [n] data events of this stream, and all error | 510 * Forwards the first [n] data events of this stream, and all error |
| 505 * events, to the returned stream, and ends with a done event. | 511 * events, to the returned stream, and ends with a done event. |
| 506 * | 512 * |
| 507 * If this stream produces fewer than [count] values before it's done, | 513 * If this stream produces fewer than [count] values before it's done, |
| 508 * so will the returned stream. | 514 * so will the returned stream. |
| 509 */ | 515 */ |
| 510 Stream<T> take(int count) { | 516 Stream<T> take(int count) { |
| 511 return new _TakeStream(this, count); | 517 return new _TakeStream(this, count); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 } | 1218 } |
| 1213 | 1219 |
| 1214 class _EventOutputSinkWrapper<T> extends EventSink<T> { | 1220 class _EventOutputSinkWrapper<T> extends EventSink<T> { |
| 1215 _EventOutputSink _sink; | 1221 _EventOutputSink _sink; |
| 1216 _EventOutputSinkWrapper(this._sink); | 1222 _EventOutputSinkWrapper(this._sink); |
| 1217 | 1223 |
| 1218 void add(T data) { _sink._sendData(data); } | 1224 void add(T data) { _sink._sendData(data); } |
| 1219 void addError(error) { _sink._sendError(error); } | 1225 void addError(error) { _sink._sendError(error); } |
| 1220 void close() { _sink._sendDone(); } | 1226 void close() { _sink._sendDone(); } |
| 1221 } | 1227 } |
| OLD | NEW |