MCPcopy Create free account
hub / github.com/angular-ui/ui-router / start

Function start

test/angular/1.5/angular-animate.js:1341–1515  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1339 }
1340
1341 function start() {
1342 if (animationClosed) return;
1343 if (!node.parentNode) {
1344 close();
1345 return;
1346 }
1347
1348 // even though we only pause keyframe animations here the pause flag
1349 // will still happen when transitions are used. Only the transition will
1350 // not be paused since that is not possible. If the animation ends when
1351 // paused then it will not complete until unpaused or cancelled.
1352 var playPause = function(playAnimation) {
1353 if (!animationCompleted) {
1354 animationPaused = !playAnimation;
1355 if (timings.animationDuration) {
1356 var value = blockKeyframeAnimations(node, animationPaused);
1357 if (animationPaused) {
1358 temporaryStyles.push(value);
1359 } else {
1360 removeFromArray(temporaryStyles, value);
1361 }
1362 }
1363 } else if (animationPaused && playAnimation) {
1364 animationPaused = false;
1365 close();
1366 }
1367 };
1368
1369 // checking the stagger duration prevents an accidentally cascade of the CSS delay style
1370 // being inherited from the parent. If the transition duration is zero then we can safely
1371 // rely that the delay value is an intentional stagger delay style.
1372 var maxStagger = itemIndex > 0
1373 && ((timings.transitionDuration && stagger.transitionDuration === 0) ||
1374 (timings.animationDuration && stagger.animationDuration === 0))
1375 && Math.max(stagger.animationDelay, stagger.transitionDelay);
1376 if (maxStagger) {
1377 $timeout(triggerAnimationStart,
1378 Math.floor(maxStagger * itemIndex * ONE_SECOND),
1379 false);
1380 } else {
1381 triggerAnimationStart();
1382 }
1383
1384 // this will decorate the existing promise runner with pause/resume methods
1385 runnerHost.resume = function() {
1386 playPause(true);
1387 };
1388
1389 runnerHost.pause = function() {
1390 playPause(false);
1391 };
1392
1393 function triggerAnimationStart() {
1394 // just incase a stagger animation kicks in when the animation
1395 // itself was cancelled entirely
1396 if (animationClosed) return;
1397
1398 applyBlocking(false);

Callers

nothing calls this directly

Calls 3

closeFunction · 0.70
triggerAnimationStartFunction · 0.70
playPauseFunction · 0.70

Tested by

no test coverage detected