blob: f85ee12a422335e0d462882c0fcdf3f321dd0edf (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 | 'use strict';
function $$RAFProvider(){ //rAF
  this.$get = ['$window', function($window) {
    var requestAnimationFrame = $window.requestAnimationFrame ||
                                $window.webkitRequestAnimationFrame;
    var cancelAnimationFrame = $window.cancelAnimationFrame ||
                               $window.webkitCancelAnimationFrame;
    var raf = function(fn) {
      var id = requestAnimationFrame(fn);
      return function() {
        cancelAnimationFrame(id);
      };
    };
    raf.supported = !!requestAnimationFrame;
    return raf;
  }];
}
 |