requestanimframe.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * ===========================================================================
  3. *
  4. * Wolf3D Browser Version GPL Source Code
  5. * Copyright (C) 2012 id Software LLC, a ZeniMax Media company.
  6. *
  7. * This file is part of the Wolf3D Browser Version GPL Source Code ("Wolf3D Browser Source Code").
  8. *
  9. * Wolf3D Browser Source Code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * Wolf3D Browser Source Code is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License version 2
  20. * along with Wolf3D Browser Source Code. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * If you have questions concerning this license, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  23. *
  24. * ===========================================================================
  25. */
  26. /* requestAnimationFrame polyfill */
  27. (function() {
  28. window.requestAnimationFrame = (function() {
  29. return window.requestAnimationFrame
  30. || window.webkitRequestAnimationFrame
  31. || window.mozRequestAnimationFrame
  32. || window.oRequestAnimationFrame
  33. || window.msRequestAnimationFrame
  34. || function(callback, element) {
  35. return window.setTimeout(
  36. function() {
  37. callback(Date.now());
  38. }, 1000 / 60
  39. );
  40. };
  41. })();
  42. window.cancelRequestAnimationFrame = (function() {
  43. return window.cancelRequestAnimationFrame
  44. || window.webkitCancelRequestAnimationFrame
  45. || window.mozCancelRequestAnimationFrame
  46. || window.oCancelRequestAnimationFrame
  47. || window.msCancelRequestAnimationFrame
  48. || window.clearTimeout;
  49. })();
  50. })();