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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 * is called. If [onData] is null, nothing happens. | 318 * is called. If [onData] is null, nothing happens. |
319 * | 319 * |
320 * On errors from this stream, the [onError] handler is given a | 320 * On errors from this stream, the [onError] handler is given a |
321 * object describing the error. | 321 * object describing the error. |
322 * | 322 * |
323 * The [onError] callback must be of type `void onError(error)` or | 323 * The [onError] callback must be of type `void onError(error)` or |
324 * `void onError(error, StackTrace stackTrace)`. If [onError] accepts | 324 * `void onError(error, StackTrace stackTrace)`. If [onError] accepts |
325 * two arguments it is called with the stack trace (which could be `null` if | 325 * two arguments it is called with the stack trace (which could be `null` if |
326 * the stream itself received an error without stack trace). | 326 * the stream itself received an error without stack trace). |
327 * Otherwise it is called with just the error object. | 327 * Otherwise it is called with just the error object. |
| 328 * If [onError] is omitted, any errors on the stream are considered unhandled, |
| 329 * and will be passed to the current [Zone]'s error handler. |
| 330 * By default unhandled async errors are treated |
| 331 * as if they were uncaught top-level errors. |
328 * | 332 * |
329 * If this stream closes, the [onDone] handler is called. | 333 * If this stream closes, the [onDone] handler is called. |
330 * | 334 * |
331 * If [cancelOnError] is true, the subscription is ended when | 335 * If [cancelOnError] is true, the subscription is ended when |
332 * the first error is reported. The default is false. | 336 * the first error is reported. The default is false. |
333 */ | 337 */ |
334 StreamSubscription<T> listen(void onData(T event), | 338 StreamSubscription<T> listen(void onData(T event), |
335 { Function onError, | 339 { Function onError, |
336 void onDone(), | 340 void onDone(), |
337 bool cancelOnError}); | 341 bool cancelOnError}); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1796 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
1793 EventSink _sink; | 1797 EventSink _sink; |
1794 _ControllerEventSinkWrapper(this._sink); | 1798 _ControllerEventSinkWrapper(this._sink); |
1795 | 1799 |
1796 void add(T data) { _sink.add(data); } | 1800 void add(T data) { _sink.add(data); } |
1797 void addError(error, [StackTrace stackTrace]) { | 1801 void addError(error, [StackTrace stackTrace]) { |
1798 _sink.addError(error, stackTrace); | 1802 _sink.addError(error, stackTrace); |
1799 } | 1803 } |
1800 void close() { _sink.close(); } | 1804 void close() { _sink.close(); } |
1801 } | 1805 } |
OLD | NEW |