PageRenderTime 31ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/RequestAnimationFrame.js

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 22 lines | 11 code | 7 blank | 4 comment | 1 complexity | a7b319f112f3dc57b9af68ae6f44ae90 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /**
  2. * Provides requestAnimationFrame in a cross browser way.
  3. * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
  4. */
  5. if ( !window.requestAnimationFrame ) {
  6. window.requestAnimationFrame = ( function() {
  7. return window.webkitRequestAnimationFrame ||
  8. window.mozRequestAnimationFrame ||
  9. window.oRequestAnimationFrame ||
  10. window.msRequestAnimationFrame ||
  11. function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element ) {
  12. window.setTimeout( callback, 1000 / 60 );
  13. };
  14. } )();
  15. }