(element, event, options, animations, fnName)
| 1707 | } |
| 1708 | |
| 1709 | function groupEventedAnimations(element, event, options, animations, fnName) { |
| 1710 | var operations = []; |
| 1711 | forEach(animations, function(ani) { |
| 1712 | var animation = ani[fnName]; |
| 1713 | if (!animation) return; |
| 1714 | |
| 1715 | // note that all of these animations will run in parallel |
| 1716 | operations.push(function() { |
| 1717 | var runner; |
| 1718 | var endProgressCb; |
| 1719 | |
| 1720 | var resolved = false; |
| 1721 | var onAnimationComplete = function(rejected) { |
| 1722 | if (!resolved) { |
| 1723 | resolved = true; |
| 1724 | (endProgressCb || noop)(rejected); |
| 1725 | runner.complete(!rejected); |
| 1726 | } |
| 1727 | }; |
| 1728 | |
| 1729 | runner = new $$AnimateRunner({ |
| 1730 | end: function() { |
| 1731 | onAnimationComplete(); |
| 1732 | }, |
| 1733 | cancel: function() { |
| 1734 | onAnimationComplete(true); |
| 1735 | } |
| 1736 | }); |
| 1737 | |
| 1738 | endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { |
| 1739 | var cancelled = result === false; |
| 1740 | onAnimationComplete(cancelled); |
| 1741 | }); |
| 1742 | |
| 1743 | return runner; |
| 1744 | }); |
| 1745 | }); |
| 1746 | |
| 1747 | return operations; |
| 1748 | } |
| 1749 | |
| 1750 | function packageAnimations(element, event, options, animations, fnName) { |
| 1751 | var operations = groupEventedAnimations(element, event, options, animations, fnName); |
no test coverage detected