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

Function $CoreAnimateCssProvider

test/angular/1.4/angular.js:5656–5715  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5654 * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
5655 */
5656var $CoreAnimateCssProvider = function() {
5657 this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
5658
5659 return function(element, initialOptions) {
5660 // all of the animation functions should create
5661 // a copy of the options data, however, if a
5662 // parent service has already created a copy then
5663 // we should stick to using that
5664 var options = initialOptions || {};
5665 if (!options.$$prepared) {
5666 options = copy(options);
5667 }
5668
5669 // there is no point in applying the styles since
5670 // there is no animation that goes on at all in
5671 // this version of $animateCss.
5672 if (options.cleanupStyles) {
5673 options.from = options.to = null;
5674 }
5675
5676 if (options.from) {
5677 element.css(options.from);
5678 options.from = null;
5679 }
5680
5681 /* jshint newcap: false*/
5682 var closed, runner = new $$AnimateRunner();
5683 return {
5684 start: run,
5685 end: run
5686 };
5687
5688 function run() {
5689 $$rAF(function() {
5690 applyAnimationContents();
5691 if (!closed) {
5692 runner.complete();
5693 }
5694 closed = true;
5695 });
5696 return runner;
5697 }
5698
5699 function applyAnimationContents() {
5700 if (options.addClass) {
5701 element.addClass(options.addClass);
5702 options.addClass = null;
5703 }
5704 if (options.removeClass) {
5705 element.removeClass(options.removeClass);
5706 options.removeClass = null;
5707 }
5708 if (options.to) {
5709 element.css(options.to);
5710 options.to = null;
5711 }
5712 }
5713 };

Callers

nothing calls this directly

Calls 1

copyFunction · 0.70

Tested by

no test coverage detected