commit | author | age
|
1759c2
|
1 |
/** |
RM |
2 |
* angular-strap |
|
3 |
* @version v2.0.3 - 2014-05-30 |
|
4 |
* @link http://mgcrea.github.io/angular-strap |
|
5 |
* @author Olivier Louvignes (olivier@mg-crea.com) |
|
6 |
* @license MIT License, http://www.opensource.org/licenses/MIT |
|
7 |
*/ |
|
8 |
'use strict'; |
|
9 |
angular.version.minor < 3 && angular.version.dot < 14 && angular.module('ng').factory('$$rAF', [ |
|
10 |
'$window', |
|
11 |
'$timeout', |
|
12 |
function ($window, $timeout) { |
|
13 |
var requestAnimationFrame = $window.requestAnimationFrame || $window.webkitRequestAnimationFrame || $window.mozRequestAnimationFrame; |
|
14 |
var cancelAnimationFrame = $window.cancelAnimationFrame || $window.webkitCancelAnimationFrame || $window.mozCancelAnimationFrame || $window.webkitCancelRequestAnimationFrame; |
|
15 |
var rafSupported = !!requestAnimationFrame; |
|
16 |
var raf = rafSupported ? function (fn) { |
|
17 |
var id = requestAnimationFrame(fn); |
|
18 |
return function () { |
|
19 |
cancelAnimationFrame(id); |
|
20 |
}; |
|
21 |
} : function (fn) { |
|
22 |
var timer = $timeout(fn, 16.66, false); |
|
23 |
// 1000 / 60 = 16.666 |
|
24 |
return function () { |
|
25 |
$timeout.cancel(timer); |
|
26 |
}; |
|
27 |
}; |
|
28 |
raf.supported = rafSupported; |
|
29 |
return raf; |
|
30 |
} |
|
31 |
]); // .factory('$$animateReflow', function($$rAF, $document) { |
|
32 |
// var bodyEl = $document[0].body; |
|
33 |
// return function(fn) { |
|
34 |
// //the returned function acts as the cancellation function |
|
35 |
// return $$rAF(function() { |
|
36 |
// //the line below will force the browser to perform a repaint |
|
37 |
// //so that all the animated elements within the animation frame |
|
38 |
// //will be properly updated and drawn on screen. This is |
|
39 |
// //required to perform multi-class CSS based animations with |
|
40 |
// //Firefox. DO NOT REMOVE THIS LINE. |
|
41 |
// var a = bodyEl.offsetWidth + 1; |
|
42 |
// fn(); |
|
43 |
// }); |
|
44 |
// }; |
|
45 |
// }); |