| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fb5c97c commit 1d7fac2
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,7 +86,12 @@ export abstract class AnimationBase implements AnimationBaseDefinition { | |||
| 86 | 86 | ||
| 87 | 87 | public play(): AnimationPromiseDefinition { | |
| 88 | 88 | if (this.isPlaying) { | |
| 89 | - throw new Error("Animation is already playing."); | ||
| 89 | + if (traceEnabled()) { | ||
| 90 | + traceWrite("Animation is already playing.", traceCategories.Animation, 2); | ||
| 91 | + } | ||
| 92 | + return <AnimationPromiseDefinition>new Promise<void>((resolve, reject) => { | ||
| 93 | + reject(); | ||
| 94 | + }); | ||
| 90 | 95 | } | |
| 91 | 96 | ||
| 92 | 97 | // We have to actually create a "Promise" due to a bug in the v8 engine and decedent promises | |
@@ -124,7 +129,9 @@ export abstract class AnimationBase implements AnimationBaseDefinition { | |||
| 124 | 129 | ||
| 125 | 130 | public cancel(): void { | |
| 126 | 131 | if (!this.isPlaying) { | |
| 127 | - throw new Error("Animation is not currently playing."); | ||
| 132 | + if (traceEnabled()) { | ||
| 133 | + traceWrite("Animation is not currently playing.", traceCategories.Animation, 2); | ||
| 134 | + } | ||
| 128 | 135 | } | |
| 129 | 136 | } | |
| 130 | 137 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,8 @@ import { View, Color } from "../core/view"; | |||
| 12 | 12 | ||
| 13 | 13 | import { AnimationCurve } from "../enums"; | |
| 14 | 14 | ||
| 15 | + import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories } from "../../trace"; | ||
| 16 | + | ||
| 15 | 17 | // Types. | |
| 16 | 18 | import { unsetValue } from "../core/properties"; | |
| 17 | 19 | import { Animation } from "./animation"; | |
@@ -161,7 +163,12 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 161 | 163 | ||
| 162 | 164 | public play(view: View): Promise<void> { | |
| 163 | 165 | if (this._isPlaying) { | |
| 164 | - throw new Error("Animation is already playing."); | ||
| 166 | + if (traceEnabled()) { | ||
| 167 | + traceWrite("Keyframe animation is already playing.", traceCategories.Animation, 2); | ||
| 168 | + } | ||
| 169 | + return new Promise<void>((resolve, reject) => { | ||
| 170 | + reject(); | ||
| 171 | + }); | ||
| 165 | 172 | } | |
| 166 | 173 | ||
| 167 | 174 | let animationFinishedPromise = new Promise<void>((resolve, reject) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments