Chromium Code Reviews| Index: utils/pub/utils.dart |
| diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart |
| index 8d17f9550430670d29fc1d4bcb1fee27433911f1..b3eb4677e5c688bf6908740d0a6484a4bfd26854 100644 |
| --- a/utils/pub/utils.dart |
| +++ b/utils/pub/utils.dart |
| @@ -104,6 +104,12 @@ String sha1(String source) { |
| return CryptoUtils.bytesToHex(sha.close()); |
| } |
| +/// Invokes the given callback asynchronously. Returns a [Future] that completes |
| +/// to the result of [callback]. |
|
nweiz
2013/02/01 02:05:55
Move all those comments about error-capturing in h
Bob Nystrom
2013/02/01 23:17:21
Done.
|
| +Future defer(callback()) { |
| + return new Future.immediate(null).then((_) => callback()); |
| +} |
| + |
| /// Returns a [Future] that completes in [milliseconds]. |
| Future sleep(int milliseconds) { |
| var completer = new Completer(); |