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

Unified Diff: corelib/src/future.dart

Issue 9372008: patch from issue 9360020 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | corelib/src/implementation/future_implementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/future.dart
diff --git a/corelib/src/future.dart b/corelib/src/future.dart
index 365f67d41c101a536491d8fda084ef6197c8365d..0cdaecdde17e9e2352111254623222e45afc794b 100644
--- a/corelib/src/future.dart
+++ b/corelib/src/future.dart
@@ -21,6 +21,8 @@
*
*/
interface Future<T> default FutureImpl<T> {
+ /** A future whose value is immediately available. */
+ Future.immediate(T value);
/**
* The value this future provided. (If called when hasValue
@@ -71,6 +73,37 @@ interface Future<T> default FutureImpl<T> {
* particular Future's value.)
*/
void handleException(bool onException(Object exception));
+
+ /**
+ * A future representing [transformation] applied to this future's value.
+ *
+ * When this future gets a value, [transformation] will be called on the
+ * value, and the returned future will receive the result.
+ *
+ * If an exception occurs (received by this future, or thrown by
+ * [transformation]) then the returned future will receive the exception.
+ *
+ * You must not add exception handlers to [this] future prior to calling
+ * transform, and any you add afterwards will not be invoked.
+ */
+ Future transform(Function transformation);
+
+ /**
+ * A future representing an asynchronous transformation applied to this
+ * future's value. [transformation] must return a Future.
+ *
+ * When this future gets a value, [transformation] will be called on the
+ * value. When the resulting future gets a value, the returned future
+ * will receive it.
+ *
+ * If an exception occurs (received by this future, thrown by
+ * [transformation], or received by the future returned by [transformation])
+ * then the returned future will receive the exception.
+ *
+ * You must not add exception handlers to [this] future prior to calling
+ * chain, and any you add afterwards will not be invoked.
+ */
+ Future chain(Function transformation);
}
« no previous file with comments | « no previous file | corelib/src/implementation/future_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698