| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,7 +74,6 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 74 | 74 | public iterations: number = 1; | |
| 75 | 75 | ||
| 76 | 76 | private _resolve; | |
| 77 | - private _reject; | ||
| 78 | 77 | private _isPlaying: boolean; | |
| 79 | 78 | private _isForwards: boolean; | |
| 80 | 79 | private _nativeAnimations: Array<Animation>; | |
@@ -161,21 +160,19 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 161 | 160 | let animation = this._nativeAnimations[0]; | |
| 162 | 161 | this._resetAnimationValues(this._target, animation); | |
| 163 | 162 | } | |
| 164 | - this._rejectAnimationFinishedPromise(); | ||
| 163 | + this._resetAnimations(); | ||
| 165 | 164 | } | |
| 166 | 165 | ||
| 167 | 166 | public play(view: View): Promise<void> { | |
| 168 | 167 | if (this._isPlaying) { | |
| 169 | - const reason = "Keyframe animation is already playing."; | ||
| 170 | - traceWrite(reason, traceCategories.Animation, traceType.warn); | ||
| 171 | - return new Promise<void>((resolve, reject) => { | ||
| 172 | - reject(reason); | ||
| 168 | + traceWrite("Keyframe animation is already playing.", traceCategories.Animation, traceType.warn); | ||
| 169 | + return new Promise<void>(resolve => { | ||
| 170 | + resolve(); | ||
| 173 | 171 | }); | |
| 174 | 172 | } | |
| 175 | 173 | ||
| 176 | - let animationFinishedPromise = new Promise<void>((resolve, reject) => { | ||
| 174 | + let animationFinishedPromise = new Promise<void>(resolve => { | ||
| 177 | 175 | this._resolve = resolve; | |
| 178 | - this._reject = reject; | ||
| 179 | 176 | }); | |
| 180 | 177 | ||
| 181 | 178 | this._isPlaying = true; | |
@@ -239,10 +236,10 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 239 | 236 | // Catch the animation cancel to prevent unhandled promise rejection warnings | |
| 240 | 237 | animation.play().then(() => { | |
| 241 | 238 | this.animate(view, index + 1, iterations); | |
| 239 | + }, (error: any) => { | ||
| 240 | + traceWrite(typeof error === "string" ? error : error.message, traceCategories.Animation, traceType.warn); | ||
| 242 | 241 | }).catch((error: any) => { | |
| 243 | - if (error.message.indexOf("Animation cancelled") < 0) { | ||
| 244 | - throw error; | ||
| 245 | - } | ||
| 242 | + traceWrite(typeof error === "string" ? error : error.message, traceCategories.Animation, traceType.warn); | ||
| 246 | 243 | }); // tslint:disable-line | |
| 247 | 244 | this._nativeAnimations.push(animation); | |
| 248 | 245 | } | |
@@ -255,11 +252,10 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 255 | 252 | this._resolve(); | |
| 256 | 253 | } | |
| 257 | 254 | ||
| 258 | - public _rejectAnimationFinishedPromise() { | ||
| 255 | + public _resetAnimations() { | ||
| 259 | 256 | this._nativeAnimations = new Array<Animation>(); | |
| 260 | 257 | this._isPlaying = false; | |
| 261 | 258 | this._target = null; | |
| 262 | - this._reject(new Error("Animation cancelled.")); | ||
| 263 | 259 | } | |
| 264 | 260 | ||
| 265 | 261 | private _resetAnimationValues(view: View, animation: Object) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments