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

Function animationCloseHandler

test/angular/1.2/angular-animate.js:1196–1218  ·  view source on GitHub ↗
(element, totalTime)

Source from the content-addressed store, hash-verified

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) {

Callers 1

animateRunFunction · 0.70

Calls 2

extractElementNodeFunction · 0.70
closeAllAnimationsFunction · 0.70

Tested by

no test coverage detected