MCPcopy Index your code
hub / github.com/angular-ui/ui-router / run

Function run

test/angular/1.3/angular-animate.js:710–755  ·  view source on GitHub ↗
(fns, cancellations, allCompleteFn)

Source from the content-addressed store, hash-verified

708 }
709
710 function run(fns, cancellations, allCompleteFn) {
711 var animations = [];
712 forEach(fns, function(animation) {
713 animation.fn && animations.push(animation);
714 });
715
716 var count = 0;
717 function afterAnimationComplete(index) {
718 if (cancellations) {
719 (cancellations[index] || noop)();
720 if (++count < animations.length) return;
721 cancellations = null;
722 }
723 allCompleteFn();
724 }
725
726 //The code below adds directly to the array in order to work with
727 //both sync and async animations. Sync animations are when the done()
728 //operation is called right away. DO NOT REFACTOR!
729 forEach(animations, function(animation, index) {
730 var progress = function() {
731 afterAnimationComplete(index);
732 };
733 switch (animation.event) {
734 case 'setClass':
735 cancellations.push(animation.fn(element, classNameAdd, classNameRemove, progress, options));
736 break;
737 case 'animate':
738 cancellations.push(animation.fn(element, className, options.from, options.to, progress));
739 break;
740 case 'addClass':
741 cancellations.push(animation.fn(element, classNameAdd || className, progress, options));
742 break;
743 case 'removeClass':
744 cancellations.push(animation.fn(element, classNameRemove || className, progress, options));
745 break;
746 default:
747 cancellations.push(animation.fn(element, progress, options));
748 break;
749 }
750 });
751
752 if (cancellations && cancellations.length === 0) {
753 allCompleteFn();
754 }
755 }
756
757 return {
758 node: node,

Callers 1

animationRunnerFunction · 0.70

Calls 1

forEachFunction · 0.70

Tested by

no test coverage detected