Download react-spring/packages/core/src/AnimationResult.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 980 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/AnimationResult.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/AnimationResult.ts
-
curl -L -o AnimationResult.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/AnimationResult.ts
980 Bytes
| import { AnimationResult } from './types' | |
| import { Readable } from './types/internal' | |
| /** @internal */ | |
| export const getCombinedResult = <T extends Readable>( | |
| target: T, | |
| results: AnimationResult<T>[] | |
| ): AnimationResult<T> => | |
| results.length == 1 | |
| ? results[0] | |
| : results.some(result => result.cancelled) | |
| ? getCancelledResult(target.get()) | |
| : results.every(result => result.noop) | |
| ? getNoopResult(target.get()) | |
| : getFinishedResult( | |
| target.get(), | |
| results.every(result => result.finished) | |
| ) | |
| /** No-op results are for updates that never start an animation. */ | |
| export const getNoopResult = (value: any) => ({ | |
| value, | |
| noop: true, | |
| finished: true, | |
| cancelled: false, | |
| }) | |
| export const getFinishedResult = ( | |
| value: any, | |
| finished: boolean, | |
| cancelled = false | |
| ) => ({ | |
| value, | |
| finished, | |
| cancelled, | |
| }) | |
| export const getCancelledResult = (value: any) => ({ | |
| value, | |
| cancelled: true, | |
| finished: false, | |
| }) | |