| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * This class has static fields that hold objects that this isolate | |
| 7 * uses to interact with the environment. Which objects are available | |
| 8 * depend on how the isolate was started. In the UI isolate | |
| 9 * of the browser, the window object is available. | |
| 10 */ | |
| 11 class Env { | |
| 12 static AnimationScheduler _animationScheduler; | |
| 13 | |
| 14 /** | |
| 15 * Provides functionality similar to [:window.requestAnimationFrame:] for | |
| 16 * all platforms. [callback] is executed on the next animation frame that | |
| 17 * occurs at or after [minTime]. If [minTime] is not specified, the first | |
| 18 * available animation frame is used. Returns an id that can be used to | |
| 19 * cancel the pending callback. | |
| 20 */ | |
| 21 static int requestAnimationFrame(AnimationCallback callback, | |
| 22 [Element element = null, | |
| 23 num minTime = null]) { | |
| 24 if (_animationScheduler == null) { | |
| 25 _animationScheduler = new AnimationScheduler(); | |
| 26 } | |
| 27 return _animationScheduler.requestAnimationFrame( | |
| 28 callback, element, minTime); | |
| 29 } | |
| 30 | |
| 31 /** | |
| 32 * Cancel the pending callback callback matching the specified [id]. | |
| 33 */ | |
| 34 static void cancelRequestAnimationFrame(int id) { | |
| 35 window.clearTimeout(id); | |
| 36 _animationScheduler.cancelRequestAnimationFrame(id); | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 typedef void XMLHttpRequestCompleted(XMLHttpRequest req); | |
| OLD | NEW |