| 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 @DocsEditable() | 7 @DocsEditable() |
| 8 $if DART2JS | 8 $if DART2JS |
| 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { | 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind
ow,DOMWindow" { |
| 10 $else | 10 $else |
| 11 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 11 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 12 $endif | 12 $endif |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Returns a Future that completes just before the window is about to | 15 * Returns a Future that completes just before the window is about to |
| 16 * repaint so the user can draw an animation frame. | 16 * repaint so the user can draw an animation frame. |
| 17 * | 17 * |
| 18 * If you need to later cancel this animation, use [requestAnimationFrame] | 18 * If you need to later cancel this animation, use [requestAnimationFrame] |
| 19 * instead. | 19 * instead. |
| 20 * | 20 * |
| 21 * The [Future] completes to a timestamp that represents a floating | 21 * The [Future] completes to a timestamp that represents a floating |
| 22 * point value of the number of milliseconds that have elapsed since the page | 22 * point value of the number of milliseconds that have elapsed since the page |
| 23 * started to load (which is also the timestamp at this call to | 23 * started to load (which is also the timestamp at this call to |
| 24 * animationFrame). | 24 * animationFrame). |
| 25 * | 25 * |
| 26 * Note: The code that runs when the future completes should call | 26 * Note: The code that runs when the future completes should call |
| 27 * [animationFrame] again for the animation to continue. | 27 * [animationFrame] again for the animation to continue. |
| 28 */ | 28 */ |
| 29 Future<num> get animationFrame { | 29 Future<num> get animationFrame { |
| 30 var completer = new Completer<num>(); | 30 var completer = new Completer<num>.sync(); |
| 31 requestAnimationFrame((time) { | 31 requestAnimationFrame((time) { |
| 32 completer.complete(time); | 32 completer.complete(time); |
| 33 }); | 33 }); |
| 34 return completer.future; | 34 return completer.future; |
| 35 } | 35 } |
| 36 | 36 |
| 37 $if DART2JS | 37 $if DART2JS |
| 38 /** | 38 /** |
| 39 * The newest document in this window. | 39 * The newest document in this window. |
| 40 * | 40 * |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 return controller.stream; | 388 return controller.stream; |
| 389 $else | 389 $else |
| 390 return stream; | 390 return stream; |
| 391 $endif | 391 $endif |
| 392 } | 392 } |
| 393 | 393 |
| 394 String getEventType(EventTarget target) { | 394 String getEventType(EventTarget target) { |
| 395 return _eventType; | 395 return _eventType; |
| 396 } | 396 } |
| 397 } | 397 } |
| OLD | NEW |