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

Function run

test/angular/1.2/angular-animate.js:462–504  ·  view source on GitHub ↗
(fns, cancellations, allCompleteFn)

Source from the content-addressed store, hash-verified

460 }
461
462 function run(fns, cancellations, allCompleteFn) {
463 var animations = [];
464 forEach(fns, function(animation) {
465 animation.fn && animations.push(animation);
466 });
467
468 var count = 0;
469 function afterAnimationComplete(index) {
470 if(cancellations) {
471 (cancellations[index] || noop)();
472 if(++count < animations.length) return;
473 cancellations = null;
474 }
475 allCompleteFn();
476 }
477
478 //The code below adds directly to the array in order to work with
479 //both sync and async animations. Sync animations are when the done()
480 //operation is called right away. DO NOT REFACTOR!
481 forEach(animations, function(animation, index) {
482 var progress = function() {
483 afterAnimationComplete(index);
484 };
485 switch(animation.event) {
486 case 'setClass':
487 cancellations.push(animation.fn(element, classNameAdd, classNameRemove, progress));
488 break;
489 case 'addClass':
490 cancellations.push(animation.fn(element, classNameAdd || className, progress));
491 break;
492 case 'removeClass':
493 cancellations.push(animation.fn(element, classNameRemove || className, progress));
494 break;
495 default:
496 cancellations.push(animation.fn(element, progress));
497 break;
498 }
499 });
500
501 if(cancellations && cancellations.length === 0) {
502 allCompleteFn();
503 }
504 }
505
506 return {
507 node : node,

Callers 1

animationRunnerFunction · 0.70

Calls 1

forEachFunction · 0.70

Tested by

no test coverage detected