(element, totalTime)
| 1194 | var closingTimestamp = 0; |
| 1195 | var animationElementQueue = []; |
| 1196 | function animationCloseHandler(element, totalTime) { |
| 1197 | var node = extractElementNode(element); |
| 1198 | element = angular.element(node); |
| 1199 | |
| 1200 | //this item will be garbage collected by the closing |
| 1201 | //animation timeout |
| 1202 | animationElementQueue.push(element); |
| 1203 | |
| 1204 | //but it may not need to cancel out the existing timeout |
| 1205 | //if the timestamp is less than the previous one |
| 1206 | var futureTimestamp = Date.now() + totalTime; |
| 1207 | if(futureTimestamp <= closingTimestamp) { |
| 1208 | return; |
| 1209 | } |
| 1210 | |
| 1211 | $timeout.cancel(closingTimer); |
| 1212 | |
| 1213 | closingTimestamp = futureTimestamp; |
| 1214 | closingTimer = $timeout(function() { |
| 1215 | closeAllAnimations(animationElementQueue); |
| 1216 | animationElementQueue = []; |
| 1217 | }, totalTime, false); |
| 1218 | } |
| 1219 | |
| 1220 | function closeAllAnimations(elements) { |
| 1221 | forEach(elements, function(element) { |
no test coverage detected