MCPcopy
hub / github.com/angular-ui/ui-grid / $CoreAnimateCssProvider

Function $CoreAnimateCssProvider

lib/test/angular/1.8.0/angular.js:6511–6569  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6509 * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
6510 */
6511var $CoreAnimateCssProvider = function() {
6512 this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
6513
6514 return function(element, initialOptions) {
6515 // all of the animation functions should create
6516 // a copy of the options data, however, if a
6517 // parent service has already created a copy then
6518 // we should stick to using that
6519 var options = initialOptions || {};
6520 if (!options.$$prepared) {
6521 options = copy(options);
6522 }
6523
6524 // there is no point in applying the styles since
6525 // there is no animation that goes on at all in
6526 // this version of $animateCss.
6527 if (options.cleanupStyles) {
6528 options.from = options.to = null;
6529 }
6530
6531 if (options.from) {
6532 element.css(options.from);
6533 options.from = null;
6534 }
6535
6536 var closed, runner = new $$AnimateRunner();
6537 return {
6538 start: run,
6539 end: run
6540 };
6541
6542 function run() {
6543 $$rAF(function() {
6544 applyAnimationContents();
6545 if (!closed) {
6546 runner.complete();
6547 }
6548 closed = true;
6549 });
6550 return runner;
6551 }
6552
6553 function applyAnimationContents() {
6554 if (options.addClass) {
6555 element.addClass(options.addClass);
6556 options.addClass = null;
6557 }
6558 if (options.removeClass) {
6559 element.removeClass(options.removeClass);
6560 options.removeClass = null;
6561 }
6562 if (options.to) {
6563 element.css(options.to);
6564 options.to = null;
6565 }
6566 }
6567 };
6568 }];

Callers

nothing calls this directly

Calls 1

copyFunction · 0.70

Tested by

no test coverage detected