refactor(animation): rename AnimationOnFinishOptions to AnimationCallbackOptions (#19551)

This commit is contained in:
Liam DeBeasi
2019-10-04 12:19:23 -04:00
committed by GitHub
parent bfb704e2d2
commit 17614cdcb3
2 changed files with 5 additions and 5 deletions

View File

@ -210,7 +210,7 @@ export interface Animation {
* Add a callback to be run * Add a callback to be run
* upon the animation ending * upon the animation ending
*/ */
onFinish(callback: AnimationLifecycle, opts?: AnimationOnFinishOptions): Animation; onFinish(callback: AnimationLifecycle, opts?: AnimationCallbackOptions): Animation;
/** @deprecated */ /** @deprecated */
playAsync(): Promise<void>; playAsync(): Promise<void>;
@ -220,7 +220,7 @@ export interface Animation {
export type AnimationLifecycle = (currentStep: 0 | 1, animation: Animation) => void; export type AnimationLifecycle = (currentStep: 0 | 1, animation: Animation) => void;
export interface AnimationOnFinishOptions { export interface AnimationCallbackOptions {
oneTimeCallback: boolean; oneTimeCallback: boolean;
} }

View File

@ -2,12 +2,12 @@
import { raf } from '../helpers'; import { raf } from '../helpers';
import { Animation, AnimationDirection, AnimationFill, AnimationKeyFrame, AnimationKeyFrames, AnimationLifecycle, AnimationOnFinishOptions, AnimationPlayOptions } from './animation-interface'; import { Animation, AnimationCallbackOptions, AnimationDirection, AnimationFill, AnimationKeyFrame, AnimationKeyFrames, AnimationLifecycle, AnimationPlayOptions } from './animation-interface';
import { addClassToArray, animationEnd, createKeyframeStylesheet, generateKeyframeName, generateKeyframeRules, removeStyleProperty, setStyleProperty } from './animation-utils'; import { addClassToArray, animationEnd, createKeyframeStylesheet, generateKeyframeName, generateKeyframeRules, removeStyleProperty, setStyleProperty } from './animation-utils';
interface AnimationOnFinishCallback { interface AnimationOnFinishCallback {
c: AnimationLifecycle; c: AnimationLifecycle;
o?: AnimationOnFinishOptions; o?: AnimationCallbackOptions;
} }
interface AnimationInternal extends Animation { interface AnimationInternal extends Animation {
@ -101,7 +101,7 @@ export const createAnimation = (): Animation => {
cleanUpStyleSheets(); cleanUpStyleSheets();
}; };
const onFinish = (callback: AnimationLifecycle, opts?: AnimationOnFinishOptions) => { const onFinish = (callback: AnimationLifecycle, opts?: AnimationCallbackOptions) => {
const callbacks = (opts && opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks; const callbacks = (opts && opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks;
callbacks.push({ c: callback, o: opts }); callbacks.push({ c: callback, o: opts });