(element, event, options, animations, fnName)
| 1985 | } |
| 1986 | |
| 1987 | function groupEventedAnimations(element, event, options, animations, fnName) { |
| 1988 | var operations = []; |
| 1989 | forEach(animations, function(ani) { |
| 1990 | var animation = ani[fnName]; |
| 1991 | if (!animation) return; |
| 1992 | |
| 1993 | // note that all of these animations will run in parallel |
| 1994 | operations.push(function() { |
| 1995 | var runner; |
| 1996 | var endProgressCb; |
| 1997 | |
| 1998 | var resolved = false; |
| 1999 | var onAnimationComplete = function(rejected) { |
| 2000 | if (!resolved) { |
| 2001 | resolved = true; |
| 2002 | (endProgressCb || noop)(rejected); |
| 2003 | runner.complete(!rejected); |
| 2004 | } |
| 2005 | }; |
| 2006 | |
| 2007 | runner = new $$AnimateRunner({ |
| 2008 | end: function() { |
| 2009 | onAnimationComplete(); |
| 2010 | }, |
| 2011 | cancel: function() { |
| 2012 | onAnimationComplete(true); |
| 2013 | } |
| 2014 | }); |
| 2015 | |
| 2016 | endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { |
| 2017 | var cancelled = result === false; |
| 2018 | onAnimationComplete(cancelled); |
| 2019 | }); |
| 2020 | |
| 2021 | return runner; |
| 2022 | }); |
| 2023 | }); |
| 2024 | |
| 2025 | return operations; |
| 2026 | } |
| 2027 | |
| 2028 | function packageAnimations(element, event, options, animations, fnName) { |
| 2029 | var operations = groupEventedAnimations(element, event, options, animations, fnName); |
no test coverage detected