(element, event, options, animations, fnName)
| 1952 | } |
| 1953 | |
| 1954 | function groupEventedAnimations(element, event, options, animations, fnName) { |
| 1955 | var operations = []; |
| 1956 | forEach(animations, function(ani) { |
| 1957 | var animation = ani[fnName]; |
| 1958 | if (!animation) return; |
| 1959 | |
| 1960 | // note that all of these animations will run in parallel |
| 1961 | operations.push(function() { |
| 1962 | var runner; |
| 1963 | var endProgressCb; |
| 1964 | |
| 1965 | var resolved = false; |
| 1966 | var onAnimationComplete = function(rejected) { |
| 1967 | if (!resolved) { |
| 1968 | resolved = true; |
| 1969 | (endProgressCb || noop)(rejected); |
| 1970 | runner.complete(!rejected); |
| 1971 | } |
| 1972 | }; |
| 1973 | |
| 1974 | runner = new $$AnimateRunner({ |
| 1975 | end: function() { |
| 1976 | onAnimationComplete(); |
| 1977 | }, |
| 1978 | cancel: function() { |
| 1979 | onAnimationComplete(true); |
| 1980 | } |
| 1981 | }); |
| 1982 | |
| 1983 | endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { |
| 1984 | var cancelled = result === false; |
| 1985 | onAnimationComplete(cancelled); |
| 1986 | }); |
| 1987 | |
| 1988 | return runner; |
| 1989 | }); |
| 1990 | }); |
| 1991 | |
| 1992 | return operations; |
| 1993 | } |
| 1994 | |
| 1995 | function packageAnimations(element, event, options, animations, fnName) { |
| 1996 | var operations = groupEventedAnimations(element, event, options, animations, fnName); |
no test coverage detected