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

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

Issue 256233005: Update documentation of StreamSubscription.cancel. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 * 1161 *
1162 * When you subscribe on a [Stream] using [Stream.listen], 1162 * When you subscribe on a [Stream] using [Stream.listen],
1163 * a [StreamSubscription] object is returned. This object 1163 * a [StreamSubscription] object is returned. This object
1164 * is used to later unsubscribe again, or to temporarily pause 1164 * is used to later unsubscribe again, or to temporarily pause
1165 * the stream's events. 1165 * the stream's events.
1166 */ 1166 */
1167 abstract class StreamSubscription<T> { 1167 abstract class StreamSubscription<T> {
1168 /** 1168 /**
1169 * Cancels this subscription. It will no longer receive events. 1169 * Cancels this subscription. It will no longer receive events.
1170 * 1170 *
1171 * If an event is currently firing, this unsubscription will only 1171 * May return a future which completes when the stream is done cleaning up.
1172 * take effect after all subscribers have received the current event. 1172 * This can be used if the stream needs to release some resources
1173 * 1173 * that are needed for a following operation,
1174 * Returns a future if the cancel-operation is not completed synchronously. 1174 * for example a file being read, that should be deleted afterwards.
1175 * Otherwise returns `null`. 1175 * In that case, the file may not be able to be deleted successfully
1176 * until the returned future has completed.
1177 * Returns `null` if there is no need to wait.
1176 */ 1178 */
1177 Future cancel(); 1179 Future cancel();
1178 1180
1179 /** Set or override the data event handler of this subscription. */ 1181 /** Set or override the data event handler of this subscription. */
1180 void onData(void handleData(T data)); 1182 void onData(void handleData(T data));
1181 1183
1182 /** 1184 /**
1183 * Set or override the error event handler of this subscription. 1185 * Set or override the error event handler of this subscription.
1184 * 1186 *
1185 * This method overrides the handler that has been set at the invocation of 1187 * This method overrides the handler that has been set at the invocation of
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 class _ControllerEventSinkWrapper<T> implements EventSink<T> { 1484 class _ControllerEventSinkWrapper<T> implements EventSink<T> {
1483 EventSink _sink; 1485 EventSink _sink;
1484 _ControllerEventSinkWrapper(this._sink); 1486 _ControllerEventSinkWrapper(this._sink);
1485 1487
1486 void add(T data) { _sink.add(data); } 1488 void add(T data) { _sink.add(data); }
1487 void addError(error, [StackTrace stackTrace]) { 1489 void addError(error, [StackTrace stackTrace]) {
1488 _sink.addError(error, stackTrace); 1490 _sink.addError(error, stackTrace);
1489 } 1491 }
1490 void close() { _sink.close(); } 1492 void close() { _sink.close(); }
1491 } 1493 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698