Files
sdk/samples-dev/swarm/swarm_ui_lib/base/Env.dart
T
Leaf Petersen 745f112ef6 Opt out some files from null safety.
Opt an initial batch of files under samples, samples-dev,
utils, and runtime/tools/dartfuzz out of null safety in preparation
for switching the flag on by default.

Change-Id: Icdfd52a5a969e678a7205903332f73fe3841c223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166960
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-12 22:15:42 +00:00

43 lines
1.5 KiB
Dart

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
part of base;
/**
* This class has static fields that hold objects that this isolate
* uses to interact with the environment. Which objects are available
* depend on how the isolate was started. In the UI isolate
* of the browser, the window object is available.
*/
class Env {
static AnimationScheduler _animationScheduler;
/**
* Provides functionality similar to [:window.requestAnimationFrame:] for
* all platforms. [callback] is executed on the next animation frame that
* occurs at or after [minTime]. If [minTime] is not specified, the first
* available animation frame is used. Returns an id that can be used to
* cancel the pending callback.
*/
static int requestAnimationFrame(AnimationCallback callback,
[Element element = null, num minTime = null]) {
if (_animationScheduler == null) {
_animationScheduler = new AnimationScheduler();
}
return _animationScheduler.requestAnimationFrame(
callback, element, minTime);
}
/**
* Cancel the pending callback callback matching the specified [id].
*/
static void cancelRequestAnimationFrame(int id) {
_animationScheduler.cancelRequestAnimationFrame(id);
}
}
typedef void XMLHttpRequestCompleted(HttpRequest req);