Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If an Animation instance is played more than once, the same promise is resolved each time leading to unexpected results. #774

Closed
hamorphis opened this issue Sep 18, 2015 · 2 comments

Comments

@hamorphis
Copy link
Contributor

Since the finished promise of an Animation is one and the same during the life of the animation, the Animation cannot be properly played multiple times, i.e. the following code fails:

animation1.play().finished
    .then(function () { return animation1.play().finished; })
    .then(function () { return animation1.play().finished; })

We should make the play() method return a new Promise each time it is played.

In other words, there should be a new promise returned for each play invocation -- not one promise per Animation instance.

@hamorphis
Copy link
Contributor Author

Breaking changes

  • (#774) Animation class no longer has a finished property because an animation can be played multiple times. The play method now returns a new Promise each time it is invoked. Use this to listen for the animation finishing or being cancelled. When upgrading to version 1.4.0 or above simply remove .finished from your code.

Old Code (JavaScript):

animation1.play().finished.then(function () { console.log("Finished"); });

New Code (JavaScript):

animation1.play().then(function () { console.log("Finished"); });

Old Code (TypeScript):

animation1.play().finished.then(()=>console.log("Finished"));

New Code (JavaScript):

animation1.play().then(()=>console.log("Finished"));

@lock
Copy link

lock bot commented Aug 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant