Skip to content

Commit

Permalink
fix: 🐛 issue when delay could accept NaN or Infinity values
Browse files Browse the repository at this point in the history
In some cases, when animateProperty() is called with bizarr values,
delay() method could accept NaN or Infinity values. This fix adds
additional check isFinite() to make sure that we can delay required
amount of time.
  • Loading branch information
ghaiklor committed Mar 15, 2020
1 parent aec72a1 commit 1905b0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kittik-animation-basic/src/Animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Animation extends EventEmitter implements AnimationOptions {
}

async delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
return new Promise(resolve => setTimeout(resolve, isFinite(ms) ? ms : 1));
}

async animateProperty<S extends Shape, P extends keyof S>(options: AnimationPropertyOptions<S, P>): Promise<S> {
Expand Down

0 comments on commit 1905b0d

Please sign in to comment.