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

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

Issue 1682013002: Documentation cleanups. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 4 years, 10 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 | « no previous file | sdk/lib/core/date_time.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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 * When you listen on a [Stream] using [Stream.listen], 1371 * When you listen on a [Stream] using [Stream.listen],
1372 * a [StreamSubscription] object is returned. 1372 * a [StreamSubscription] object is returned.
1373 * 1373 *
1374 * The subscription provides events to the listener, 1374 * The subscription provides events to the listener,
1375 * and holds the callbacks used to handle the events. 1375 * and holds the callbacks used to handle the events.
1376 * The subscription can also be used to unsubscribe from the events, 1376 * The subscription can also be used to unsubscribe from the events,
1377 * or to temporarily pause the events from the stream. 1377 * or to temporarily pause the events from the stream.
1378 */ 1378 */
1379 abstract class StreamSubscription<T> { 1379 abstract class StreamSubscription<T> {
1380 /** 1380 /**
1381 * Cancels this subscription. It will no longer receive events. 1381 * Cancels this subscription.
1382 * 1382 *
1383 * May return a future which completes when the stream is done cleaning up. 1383 * After this call, the subscription no longer receives events.
1384 * This can be used if the stream needs to release some resources
1385 * that are needed for a following operation,
1386 * for example a file being read, that should be deleted afterwards.
1387 * In that case, the file may not be able to be deleted successfully
1388 * until the returned future has completed.
1389 * 1384 *
1390 * The future will be completed with a `null` value. 1385 * The stream may need to shut down the source of events and clean up after
1386 * the subscription is canceled.
1387 *
1388 * Returns a future that is completed once the stream has finished
1389 * its cleanup. May also return `null` if no cleanup was necessary.
1390 *
1391 * Typically, futures are returned when the stream needs to release resources.
1392 * For example, a stream might need to close an open file (as an asynchronous
1393 * operation). If the listener wants to delete the file after having
1394 * canceled the subscription, it must wait for the cleanup future to complete.
1395 *
1396 * A returned future completes with a `null` value.
1391 * If the cleanup throws, which it really shouldn't, the returned future 1397 * If the cleanup throws, which it really shouldn't, the returned future
1392 * will be completed with that error. 1398 * completes with that error.
1393 *
1394 * Returns `null` if there is no need to wait.
1395 */ 1399 */
1396 Future cancel(); 1400 Future cancel();
1397 1401
1398 /** 1402 /**
1399 * Set or override the data event handler of this subscription. 1403 * Set or override the data event handler of this subscription.
1400 * 1404 *
1401 * This method overrides the handler that has been set at the invocation of 1405 * This method overrides the handler that has been set at the invocation of
1402 * [Stream.listen]. 1406 * [Stream.listen].
1403 */ 1407 */
1404 void onData(void handleData(T data)); 1408 void onData(void handleData(T data));
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 class _ControllerEventSinkWrapper<T> implements EventSink<T> { 1800 class _ControllerEventSinkWrapper<T> implements EventSink<T> {
1797 EventSink _sink; 1801 EventSink _sink;
1798 _ControllerEventSinkWrapper(this._sink); 1802 _ControllerEventSinkWrapper(this._sink);
1799 1803
1800 void add(T data) { _sink.add(data); } 1804 void add(T data) { _sink.add(data); }
1801 void addError(error, [StackTrace stackTrace]) { 1805 void addError(error, [StackTrace stackTrace]) {
1802 _sink.addError(error, stackTrace); 1806 _sink.addError(error, stackTrace);
1803 } 1807 }
1804 void close() { _sink.close(); } 1808 void close() { _sink.close(); }
1805 } 1809 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/core/date_time.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698