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 30 matching lines...) Expand all Loading... |
41 * | 41 * |
42 * *A broadcast stream* allows any number of listeners, and it fires | 42 * *A broadcast stream* allows any number of listeners, and it fires |
43 * its events when they are ready, whether there are listeners or not. | 43 * its events when they are ready, whether there are listeners or not. |
44 * | 44 * |
45 * Broadcast streams are used for independent events/observers. | 45 * Broadcast streams are used for independent events/observers. |
46 * | 46 * |
47 * If several listeners want to listen to a single subscription stream, | 47 * If several listeners want to listen to a single subscription stream, |
48 * use [asBroadcastStream] to create a broadcast stream on top of the | 48 * use [asBroadcastStream] to create a broadcast stream on top of the |
49 * non-broadcast stream. | 49 * non-broadcast stream. |
50 * | 50 * |
51 * On either kind of stream, stream transformationss, such as [where] and | 51 * On either kind of stream, stream transformations, such as [where] and |
52 * [skip], return the same type of stream as the one the method was called on, | 52 * [skip], return the same type of stream as the one the method was called on, |
53 * unless otherwise noted. | 53 * unless otherwise noted. |
54 * | 54 * |
55 * When an event is fired, the listener(s) at that time will receive the event. | 55 * When an event is fired, the listener(s) at that time will receive the event. |
56 * If a listener is added to a broadcast stream while an event is being fired, | 56 * If a listener is added to a broadcast stream while an event is being fired, |
57 * that listener will not receive the event currently being fired. | 57 * that listener will not receive the event currently being fired. |
58 * If a listener is canceled, it immediately stops receiving events. | 58 * If a listener is canceled, it immediately stops receiving events. |
59 * | 59 * |
60 * When the "done" event is fired, subscribers are unsubscribed before | 60 * When the "done" event is fired, subscribers are unsubscribed before |
61 * receiving the event. After the event has been sent, the stream has no | 61 * receiving the event. After the event has been sent, the stream has no |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1658 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
1659 EventSink _sink; | 1659 EventSink _sink; |
1660 _ControllerEventSinkWrapper(this._sink); | 1660 _ControllerEventSinkWrapper(this._sink); |
1661 | 1661 |
1662 void add(T data) { _sink.add(data); } | 1662 void add(T data) { _sink.add(data); } |
1663 void addError(error, [StackTrace stackTrace]) { | 1663 void addError(error, [StackTrace stackTrace]) { |
1664 _sink.addError(error, stackTrace); | 1664 _sink.addError(error, stackTrace); |
1665 } | 1665 } |
1666 void close() { _sink.close(); } | 1666 void close() { _sink.close(); } |
1667 } | 1667 } |
OLD | NEW |