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

View File

@@ -5,6 +5,7 @@
* full text of the license.
*
* @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Vendor.js
*/
/**
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
* Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available
*/
var isNative = !!(window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
var requestAnimationFrame = OpenLayers.Vendor.jsPrefix(window, "requestAnimationFrame");
var isNative = !!(requestAnimationFrame);
/**
* Function: requestFrame
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
* element - {DOMElement} Optional element that visually bounds the animation.
*/
var requestFrame = (function() {
var request = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
var request = window[requestAnimationFrame] ||
function(callback, element) {
window.setTimeout(callback, 16);
};