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

Function $CoreAnimateCssProvider

lib/test/angular/1.5.0/angular.js:5696–5755  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5694 * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
5695 */
5696var $CoreAnimateCssProvider = function() {
5697 this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
5698
5699 return function(element, initialOptions) {
5700 // all of the animation functions should create
5701 // a copy of the options data, however, if a
5702 // parent service has already created a copy then
5703 // we should stick to using that
5704 var options = initialOptions || {};
5705 if (!options.$$prepared) {
5706 options = copy(options);
5707 }
5708
5709 // there is no point in applying the styles since
5710 // there is no animation that goes on at all in
5711 // this version of $animateCss.
5712 if (options.cleanupStyles) {
5713 options.from = options.to = null;
5714 }
5715
5716 if (options.from) {
5717 element.css(options.from);
5718 options.from = null;
5719 }
5720
5721 /* jshint newcap: false */
5722 var closed, runner = new $$AnimateRunner();
5723 return {
5724 start: run,
5725 end: run
5726 };
5727
5728 function run() {
5729 $$rAF(function() {
5730 applyAnimationContents();
5731 if (!closed) {
5732 runner.complete();
5733 }
5734 closed = true;
5735 });
5736 return runner;
5737 }
5738
5739 function applyAnimationContents() {
5740 if (options.addClass) {
5741 element.addClass(options.addClass);
5742 options.addClass = null;
5743 }
5744 if (options.removeClass) {
5745 element.removeClass(options.removeClass);
5746 options.removeClass = null;
5747 }
5748 if (options.to) {
5749 element.css(options.to);
5750 options.to = null;
5751 }
5752 }
5753 };

Callers

nothing calls this directly

Calls 1

copyFunction · 0.70

Tested by

no test coverage detected