Use vendor detection for requestAnimationFrame

This commit is contained in:
Gregers Gram Rygg
2012-06-25 13:45:33 +02:00
parent 58a83b0d17
commit ab6b2ef008
2 changed files with 5 additions and 10 deletions
+4 -10
View File
@@ -5,6 +5,7 @@
* full text of the license. * full text of the license.
* *
* @requires OpenLayers/SingleFile.js * @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Vendor.js
*/ */
/** /**
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
* Property: isNative * Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available * {Boolean} true if a native requestAnimationFrame function is available
*/ */
var isNative = !!(window.requestAnimationFrame || var requestAnimationFrame = OpenLayers.Vendor.jsPrefix(window, "requestAnimationFrame");
window.webkitRequestAnimationFrame || var isNative = !!(requestAnimationFrame);
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
/** /**
* Function: requestFrame * Function: requestFrame
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
* element - {DOMElement} Optional element that visually bounds the animation. * element - {DOMElement} Optional element that visually bounds the animation.
*/ */
var requestFrame = (function() { var requestFrame = (function() {
var request = window.requestAnimationFrame || var request = window[requestAnimationFrame] ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element) { function(callback, element) {
window.setTimeout(callback, 16); window.setTimeout(callback, 16);
}; };
+1
View File
@@ -6,6 +6,7 @@
// dependencies for tests // dependencies for tests
var OpenLayers = [ var OpenLayers = [
"OpenLayers/Vendor.js",
"OpenLayers/Animation.js" "OpenLayers/Animation.js"
]; ];