(element, event, options, animations, fnName)
| 1748 | } |
| 1749 | |
| 1750 | function packageAnimations(element, event, options, animations, fnName) { |
| 1751 | var operations = groupEventedAnimations(element, event, options, animations, fnName); |
| 1752 | if (operations.length === 0) { |
| 1753 | var a,b; |
| 1754 | if (fnName === 'beforeSetClass') { |
| 1755 | a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); |
| 1756 | b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); |
| 1757 | } else if (fnName === 'setClass') { |
| 1758 | a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); |
| 1759 | b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); |
| 1760 | } |
| 1761 | |
| 1762 | if (a) { |
| 1763 | operations = operations.concat(a); |
| 1764 | } |
| 1765 | if (b) { |
| 1766 | operations = operations.concat(b); |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | if (operations.length === 0) return; |
| 1771 | |
| 1772 | // TODO(matsko): add documentation |
| 1773 | return function startAnimation(callback) { |
| 1774 | var runners = []; |
| 1775 | if (operations.length) { |
| 1776 | forEach(operations, function(animateFn) { |
| 1777 | runners.push(animateFn()); |
| 1778 | }); |
| 1779 | } |
| 1780 | |
| 1781 | runners.length ? $$AnimateRunner.all(runners, callback) : callback(); |
| 1782 | |
| 1783 | return function endFn(reject) { |
| 1784 | forEach(runners, function(runner) { |
| 1785 | reject ? runner.cancel() : runner.end(); |
| 1786 | }); |
| 1787 | }; |
| 1788 | }; |
| 1789 | } |
| 1790 | }; |
| 1791 | |
| 1792 | function lookupAnimations(classes) { |
no test coverage detected