luster-io / impulse

Dynamic Physics Interactions for the Mobile Web
http://impulse.luster.io
MIT License
1.59k stars 74 forks source link

Animation.cancel throws an exception when clicking during an animation #33

Open incraigulous opened 9 years ago

incraigulous commented 9 years ago

If you click a trigger too quickly, animation.cancel will throw an exception because this._reject() is not set. I was able to replicate this on the Luster.io website using the nav on Chrome/Mac, so I know it's not my implementation.

danro commented 9 years ago

Noticed this today too.. seems that Chrome has implemented some new promise logging. :neutral_face:

Since it can get very noisy to cancel animations... should we wrap every this._reject() in try/catch?

Feels dirty, is there a better way?

xcoderzach commented 9 years ago

Sorry @incraigulous I didn't see this until now. I just repro'd it. Maybe a canceled animation shouldn't reject the promise?

I still have a hard time with understanding which cases should be resolved and which should be rejected.

xcoderzach commented 9 years ago

I could also just add an empty

promise.catch(function() {  })
danro commented 9 years ago

Ah that sounds better. You could expose that for testing later as well. :+1:

incraigulous commented 9 years ago

Thanks guys! On Wed, Jan 28, 2015 at 12:58 PM Dan Rogers notifications@github.com wrote:

Ah that sounds better. You could expose that for testing later as well. [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/luster-io/impulse/issues/33#issuecomment-71893487.