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