| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 * | 151 * |
| 152 * If this stream is single-subscription, return a new stream that allows | 152 * If this stream is single-subscription, return a new stream that allows |
| 153 * multiple subscribers. It will subscribe to this stream when its first | 153 * multiple subscribers. It will subscribe to this stream when its first |
| 154 * subscriber is added, and unsubscribe again when the last subscription is | 154 * subscriber is added, and unsubscribe again when the last subscription is |
| 155 * canceled. | 155 * canceled. |
| 156 * | 156 * |
| 157 * If this stream is already a broadcast stream, it is returned unmodified. | 157 * If this stream is already a broadcast stream, it is returned unmodified. |
| 158 */ | 158 */ |
| 159 Stream<T> asBroadcastStream() { | 159 Stream<T> asBroadcastStream() { |
| 160 if (isBroadcast) return this; | 160 if (isBroadcast) return this; |
| 161 return new _SingleStreamMultiplexer<T>(this); | 161 return new _AsBroadcastStream<T>(this); |
| 162 } | 162 } |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * Adds a subscription to this stream. | 165 * Adds a subscription to this stream. |
| 166 * | 166 * |
| 167 * On each data event from this stream, the subscriber's [onData] handler | 167 * On each data event from this stream, the subscriber's [onData] handler |
| 168 * is called. If [onData] is null, nothing happens. | 168 * is called. If [onData] is null, nothing happens. |
| 169 * | 169 * |
| 170 * On errors from this stream, the [onError] handler is given a | 170 * On errors from this stream, the [onError] handler is given a |
| 171 * object describing the error. | 171 * object describing the error. |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 * | 1241 * |
| 1242 * If a [moveNext] call has been made, it will complete with `false` as value, | 1242 * If a [moveNext] call has been made, it will complete with `false` as value, |
| 1243 * as will all further calls to [moveNext]. | 1243 * as will all further calls to [moveNext]. |
| 1244 * | 1244 * |
| 1245 * If you need to stop listening for values before the stream iterator is | 1245 * If you need to stop listening for values before the stream iterator is |
| 1246 * automatically closed, you must call [cancel] to ensure that the stream | 1246 * automatically closed, you must call [cancel] to ensure that the stream |
| 1247 * is properly closed. | 1247 * is properly closed. |
| 1248 */ | 1248 */ |
| 1249 void cancel(); | 1249 void cancel(); |
| 1250 } | 1250 } |
| OLD | NEW |