MCPcopy
hub / github.com/angular-ui/ui-router / animationCloseHandler

Function animationCloseHandler

test/angular/1.3/angular-animate.js:1666–1688  ·  view source on GitHub ↗
(element, totalTime)

Source from the content-addressed store, hash-verified

1664 var closingTimestamp = 0;
1665 var animationElementQueue = [];
1666 function animationCloseHandler(element, totalTime) {
1667 var node = extractElementNode(element);
1668 element = angular.element(node);
1669
1670 //this item will be garbage collected by the closing
1671 //animation timeout
1672 animationElementQueue.push(element);
1673
1674 //but it may not need to cancel out the existing timeout
1675 //if the timestamp is less than the previous one
1676 var futureTimestamp = Date.now() + totalTime;
1677 if (futureTimestamp <= closingTimestamp) {
1678 return;
1679 }
1680
1681 $timeout.cancel(closingTimer);
1682
1683 closingTimestamp = futureTimestamp;
1684 closingTimer = $timeout(function() {
1685 closeAllAnimations(animationElementQueue);
1686 animationElementQueue = [];
1687 }, totalTime, false);
1688 }
1689
1690 function closeAllAnimations(elements) {
1691 forEach(elements, function(element) {

Callers 1

animateRunFunction · 0.70

Calls 2

extractElementNodeFunction · 0.70
closeAllAnimationsFunction · 0.70

Tested by

no test coverage detected