(element, totalTime)
| 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) { |
no test coverage detected