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

Unified Diff: sdk/lib/async/future.dart

Issue 12224081: Change Future.delayed to take a Duration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove const Duration(). Created 7 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
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index efa4144186a14e2a2a9536ac506e2ee5494365f0..4691fde5d2074cb8952aeb7b5d6e6535a15b98fb 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -137,19 +137,22 @@ abstract class Future<T> {
/**
* Creates a future that completes after a delay.
*
- * The future will be completed after [milliseconds] have passed with
- * the result of calling [value]. If [milliseconds] is 0, it completes at the
- * earliest in the next event-loop iteration.
+ * The future will be completed after the given [duration] has passed with
+ * the result of calling [value]. If the duration is 0 or less, it completes
+ * at the earliest in the next event-loop iteration.
Lasse Reichstein Nielsen 2013/02/12 14:53:10 at the earliest -> no sooner than
floitsch 2013/02/13 19:27:30 Done.
*
* If calling [value] throws, the created future will complete with the
* error.
*
* See [Completer]s, for futures with values that are computed asynchronously.
+ *
+ * *Deprecation note*: this method initially took an [int] as argument (the
+ * milliseconds to wait). It is now a [Duration].
*/
- factory Future.delayed(int milliseconds, T value()) {
+ factory Future.delayed(var duration, T value()) {
Lasse Reichstein Nielsen 2013/02/12 14:53:10 I'm not opposed to making value optional. I don't
floitsch 2013/02/13 19:27:30 Done.
_ThenFuture<dynamic, T> future =
new _ThenFuture<dynamic, T>((_) => value());
- new Timer(milliseconds, (_) => future._sendValue(null));
+ new Timer(duration, () => future._sendValue(null));
return future;
}

Powered by Google App Engine
This is Rietveld 408576698