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