Sha256: f189eb321a086c15716f25748c0d32bd20eb00f8635f5c2b94e20a58039f1467

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

/*global define*/
define(['Core/defined'], function(defined) {
    "use strict";

    var implementation = window.cancelAnimationFrame;
    (function() {
        // look for vendor prefixed function
        if (!defined(implementation)) {
            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}.
     *
     * @exports cancelAnimationFrame
     *
     * @param requestID The value returned by @{link requestAnimationFrame}.
     *
     * @see <a href='http://www.w3.org/TR/animation-timing/#the-WindowAnimationTiming-interface'>The WindowAnimationTiming interface</a>
     */
    var cancelAnimationFrame = function(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);
    };

    return cancelAnimationFrame;
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cesium-0.25.0 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.24.1 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.24.0 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.23.0 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.22.0 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.21.1 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.21 app/assets/javascripts/Core/cancelAnimationFrame.js
cesium-0.20.0 app/assets/javascripts/Core/cancelAnimationFrame.js