(element, event, options, animations, fnName)
| 2026 | } |
| 2027 | |
| 2028 | function packageAnimations(element, event, options, animations, fnName) { |
| 2029 | var operations = groupEventedAnimations(element, event, options, animations, fnName); |
| 2030 | if (operations.length === 0) { |
| 2031 | var a,b; |
| 2032 | if (fnName === 'beforeSetClass') { |
| 2033 | a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); |
| 2034 | b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); |
| 2035 | } else if (fnName === 'setClass') { |
| 2036 | a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); |
| 2037 | b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); |
| 2038 | } |
| 2039 | |
| 2040 | if (a) { |
| 2041 | operations = operations.concat(a); |
| 2042 | } |
| 2043 | if (b) { |
| 2044 | operations = operations.concat(b); |
| 2045 | } |
| 2046 | } |
| 2047 | |
| 2048 | if (operations.length === 0) return; |
| 2049 | |
| 2050 | // TODO(matsko): add documentation |
| 2051 | return function startAnimation(callback) { |
| 2052 | var runners = []; |
| 2053 | if (operations.length) { |
| 2054 | forEach(operations, function(animateFn) { |
| 2055 | runners.push(animateFn()); |
| 2056 | }); |
| 2057 | } |
| 2058 | |
| 2059 | runners.length ? $$AnimateRunner.all(runners, callback) : callback(); |
| 2060 | |
| 2061 | return function endFn(reject) { |
| 2062 | forEach(runners, function(runner) { |
| 2063 | reject ? runner.cancel() : runner.end(); |
| 2064 | }); |
| 2065 | }; |
| 2066 | }; |
| 2067 | } |
| 2068 | }; |
| 2069 | |
| 2070 | function lookupAnimations(classes) { |
no test coverage detected