Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: sdk/lib/async/stream.dart

Issue 2946283002: Fix a couple of doc comment references - and many spelling mistakes (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/zone.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 * void add(String data) { 264 * void add(String data) {
265 * _outputSink.add(data); 265 * _outputSink.add(data);
266 * _outputSink.add(data); 266 * _outputSink.add(data);
267 * } 267 * }
268 * 268 *
269 * void addError(e, [st]) { _outputSink.addError(e, st); } 269 * void addError(e, [st]) { _outputSink.addError(e, st); }
270 * void close() { _outputSink.close(); } 270 * void close() { _outputSink.close(); }
271 * } 271 * }
272 * 272 *
273 * class DuplicationTransformer implements StreamTransformer<String, Strin g> { 273 * class DuplicationTransformer implements StreamTransformer<String, Strin g> {
274 * // Some generic types ommitted for brevety. 274 * // Some generic types omitted for brevity.
275 * Stream bind(Stream stream) => new Stream<String>.eventTransformed( 275 * Stream bind(Stream stream) => new Stream<String>.eventTransformed(
276 * stream, 276 * stream,
277 * (EventSink sink) => new DuplicationSink(sink)); 277 * (EventSink sink) => new DuplicationSink(sink));
278 * } 278 * }
279 * 279 *
280 * stringStream.transform(new DuplicationTransformer()); 280 * stringStream.transform(new DuplicationTransformer());
281 * 281 *
282 * The resulting stream is a broadcast stream if [source] is. 282 * The resulting stream is a broadcast stream if [source] is.
283 */ 283 */
284 factory Stream.eventTransformed( 284 factory Stream.eventTransformed(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 /** 459 /**
460 * Transforms each element into a sequence of asynchronous events. 460 * Transforms each element into a sequence of asynchronous events.
461 * 461 *
462 * Returns a new stream and for each event of this stream, do the following: 462 * Returns a new stream and for each event of this stream, do the following:
463 * 463 *
464 * * If the event is an error event or a done event, it is emitted directly 464 * * If the event is an error event or a done event, it is emitted directly
465 * by the returned stream. 465 * by the returned stream.
466 * * Otherwise it is an element. Then the [convert] function is called 466 * * Otherwise it is an element. Then the [convert] function is called
467 * with the element as argument to produce a convert-stream for the element. 467 * with the element as argument to produce a convert-stream for the element.
468 * * If that call throws, the error is emitted on the returned stream. 468 * * If that call throws, the error is emitted on the returned stream.
469 * * If the call returnes `null`, no further action is taken for the elements. 469 * * If the call returns `null`, no further action is taken for the elements.
470 * * Otherwise, this stream is paused and convert-stream is listened to. 470 * * Otherwise, this stream is paused and convert-stream is listened to.
471 * Every data and error event of the convert-stream is emitted on the returned 471 * Every data and error event of the convert-stream is emitted on the returned
472 * stream in the order it is produced. 472 * stream in the order it is produced.
473 * When the convert-stream ends, this stream is resumed. 473 * When the convert-stream ends, this stream is resumed.
474 * 474 *
475 * The returned stream is a broadcast stream if this stream is. 475 * The returned stream is a broadcast stream if this stream is.
476 */ 476 */
477 Stream<E> asyncExpand<E>(Stream<E> convert(T event)) { 477 Stream<E> asyncExpand<E>(Stream<E> convert(T event)) {
478 StreamController<E> controller; 478 StreamController<E> controller;
479 StreamSubscription<T> subscription; 479 StreamSubscription<T> subscription;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return future; 775 return future;
776 } 776 }
777 777
778 /** 778 /**
779 * Executes [action] on each element of the stream. 779 * Executes [action] on each element of the stream.
780 * 780 *
781 * Completes the returned [Future] when all elements of the stream 781 * Completes the returned [Future] when all elements of the stream
782 * have been processed. 782 * have been processed.
783 * 783 *
784 * If the stream contains an error, or if the call to [action] throws, 784 * If the stream contains an error, or if the call to [action] throws,
785 * the returne future completes with that error, and processing stops. 785 * the returned future completes with that error, and processing stops.
786 */ 786 */
787 Future forEach(void action(T element)) { 787 Future forEach(void action(T element)) {
788 _Future future = new _Future(); 788 _Future future = new _Future();
789 StreamSubscription subscription; 789 StreamSubscription subscription;
790 subscription = this.listen( 790 subscription = this.listen(
791 (T element) { 791 (T element) {
792 // TODO(floitsch): the type should be 'void' and inferred. 792 // TODO(floitsch): the type should be 'void' and inferred.
793 _runUserCode<dynamic>(() => action(element), (_) {}, 793 _runUserCode<dynamic>(() => action(element), (_) {},
794 _cancelAndErrorClosure(subscription, future)); 794 _cancelAndErrorClosure(subscription, future));
795 }, 795 },
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 * [Stream.listen], by calling [asFuture], or by a previous call to [onError]. 1543 * [Stream.listen], by calling [asFuture], or by a previous call to [onError].
1544 */ 1544 */
1545 void onError(Function handleError); 1545 void onError(Function handleError);
1546 1546
1547 /** 1547 /**
1548 * Replaces the done event handler of this subscription. 1548 * Replaces the done event handler of this subscription.
1549 * 1549 *
1550 * The [handleDone] function is called when the stream closes. 1550 * The [handleDone] function is called when the stream closes.
1551 * The value may be `null`, in which case no function is called. 1551 * The value may be `null`, in which case no function is called.
1552 * 1552 *
1553 * This method reaplces the current handler set by the invocation of 1553 * This method replaces the current handler set by the invocation of
1554 * [Stream.listen], by calling [asFuture], or by a previous call to [onDone]. 1554 * [Stream.listen], by calling [asFuture], or by a previous call to [onDone].
1555 */ 1555 */
1556 void onDone(void handleDone()); 1556 void onDone(void handleDone());
1557 1557
1558 /** 1558 /**
1559 * Request that the stream pauses events until further notice. 1559 * Request that the stream pauses events until further notice.
1560 * 1560 *
1561 * While paused, the subscription will not fire any events. 1561 * While paused, the subscription will not fire any events.
1562 * If it receives events from its source, they will be buffered until 1562 * If it receives events from its source, they will be buffered until
1563 * the subscription is resumed. 1563 * the subscription is resumed.
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 } 1990 }
1991 1991
1992 void addError(error, [StackTrace stackTrace]) { 1992 void addError(error, [StackTrace stackTrace]) {
1993 _sink.addError(error, stackTrace); 1993 _sink.addError(error, stackTrace);
1994 } 1994 }
1995 1995
1996 void close() { 1996 void close() {
1997 _sink.close(); 1997 _sink.close();
1998 } 1998 }
1999 } 1999 }
OLDNEW
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/zone.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698