15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import defined from "./defined.js";
 
var implementation;
if (typeof cancelAnimationFrame !== "undefined") {
  implementation = cancelAnimationFrame;
}
 
(function () {
  // look for vendor prefixed function
  if (!defined(implementation) && typeof window !== "undefined") {
    var vendors = ["webkit", "moz", "ms", "o"];
    var i = 0;
    var len = vendors.length;
    while (i < len && !defined(implementation)) {
      implementation = window[vendors[i] + "CancelAnimationFrame"];
      if (!defined(implementation)) {
        implementation = window[vendors[i] + "CancelRequestAnimationFrame"];
      }
      ++i;
    }
  }
 
  // otherwise, assume requestAnimationFrame is based on setTimeout, so use clearTimeout
  if (!defined(implementation)) {
    implementation = clearTimeout;
  }
})();
 
/**
 * A browser-independent function to cancel an animation frame requested using {@link requestAnimationFrame}.
 *
 * @function cancelAnimationFrame
 *
 * @param {Number} requestID The value returned by {@link requestAnimationFrame}.
 *
 * @see {@link http://www.w3.org/TR/animation-timing/#the-WindowAnimationTiming-interface|The WindowAnimationTiming interface}
 */
function cancelAnimationFramePolyfill(requestID) {
  // we need this extra wrapper function because the native cancelAnimationFrame
  // functions must be invoked on the global scope (window), which is not the case
  // if invoked as Cesium.cancelAnimationFrame(requestID)
  implementation(requestID);
}
export default cancelAnimationFramePolyfill;