-
Notifications
You must be signed in to change notification settings - Fork 0
/
ng-animator.min.js
6 lines (6 loc) · 1.2 KB
/
ng-animator.min.js
1
2
3
4
5
6
/**
* ngAnimator v1.0.0
* Paradigm of 'central application processor' with requestAnimationFrame technique for AngularJS
* by Vasiliy Os <[email protected]>
*/
!function(a){"use strict";a.module("ngAnimator",[]),a.module("ngAnimator").factory("ngAnimator",function(){for(var a=["ms","moz","webkit","o"],b=window.requestAnimationFrame,c=window.cancelAnimationFrame,d=0;d<a.length&&!b;++d)b=window[a[d]+"RequestAnimationFrame"],c=window[a[d]+"CancelAnimationFrame"]||window[a[d]+"CancelRequestAnimationFrame"];if(!b){var e,f,g,h,i=Math.max,j=window.setTimeout;b=function(a){return f=(new Date).getTime(),g=i(0,16-(f-e)),h=j(function(){a(f+g)},g),e=f+g,h}}if(!c){var k=window.clearTimeout;c=function(a){return k(a)}}var l,m={requestAnimationFrame:b,cancelAnimationFrame:c},n=m.pool=[];return m.add=function(a){return n.unshift(a),l||m.start(),m},m.remove=function(a){for(var b;(b=n.indexOf(a))>=0;)n.splice(b,1)[0]=null;return n.length||m.stop(),m},m.isRunned=function(a){return!!l&&n.indexOf(a)>=0},m.start=function(){var a,c;return m.stop(),l=b(function d(){if(l=b(d),c=n.length)for(a=n.slice();c--;)a[c]()}),m},m.stop=function(){return c(l),l=null,m},m.flush=function(){return n.splice(-n.length),this.stop(),m},m})}(angular);