| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Generic utility functions. Stuff that should possibly be in core. | 6 * Generic utility functions. Stuff that should possibly be in core. |
| 7 */ | 7 */ |
| 8 #library('utils'); | 8 library utils; |
| 9 | 9 |
| 10 #import('dart:crypto'); | 10 import 'dart:crypto'; |
| 11 #import('dart:isolate'); | 11 import 'dart:isolate'; |
| 12 | 12 |
| 13 /** A pair of values. */ | 13 /** A pair of values. */ |
| 14 class Pair<E, F> { | 14 class Pair<E, F> { |
| 15 E first; | 15 E first; |
| 16 F last; | 16 F last; |
| 17 | 17 |
| 18 Pair(this.first, this.last); | 18 Pair(this.first, this.last); |
| 19 | 19 |
| 20 String toString() => '($first, $last)'; | 20 String toString() => '($first, $last)'; |
| 21 | 21 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 CryptoUtils.bytesToHex(new SHA1().update(source.charCodes()).digest()); | 122 CryptoUtils.bytesToHex(new SHA1().update(source.charCodes()).digest()); |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Returns a [Future] that completes in [milliSeconds]. | 125 * Returns a [Future] that completes in [milliSeconds]. |
| 126 */ | 126 */ |
| 127 Future sleep(int milliSeconds) { | 127 Future sleep(int milliSeconds) { |
| 128 var completer = new Completer(); | 128 var completer = new Completer(); |
| 129 new Timer(milliSeconds, completer.complete); | 129 new Timer(milliSeconds, completer.complete); |
| 130 return completer.future; | 130 return completer.future; |
| 131 } | 131 } |
| OLD | NEW |