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

Function onAnimationProgress

test/angular/1.4/angular-animate.js:1331–1356  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

1329 }
1330
1331 function onAnimationProgress(event) {
1332 event.stopPropagation();
1333 var ev = event.originalEvent || event;
1334
1335 // we now always use `Date.now()` due to the recent changes with
1336 // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)
1337 var timeStamp = ev.$manualTimeStamp || Date.now();
1338
1339 /* Firefox (or possibly just Gecko) likes to not round values up
1340 * when a ms measurement is used for the animation */
1341 var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
1342
1343 /* $manualTimeStamp is a mocked timeStamp value which is set
1344 * within browserTrigger(). This is only here so that tests can
1345 * mock animations properly. Real events fallback to event.timeStamp,
1346 * or, if they don't, then a timeStamp is automatically created for them.
1347 * We're checking to see if the timeStamp surpasses the expected delay,
1348 * but we're using elapsedTime instead of the timeStamp on the 2nd
1349 * pre-condition since animationPauseds sometimes close off early */
1350 if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
1351 // we set this flag to ensure that if the transition is paused then, when resumed,
1352 // the animation will automatically close itself since transitions cannot be paused.
1353 animationCompleted = true;
1354 close();
1355 }
1356 }
1357
1358 function start() {
1359 if (animationClosed) return;

Callers

nothing calls this directly

Calls 1

closeFunction · 0.70

Tested by

no test coverage detected