wimbarelds / TimeCircles

jQuery plugin to show time since or time until a specific time
295 stars 149 forks source link

Callback continue to be called after ".destroy()" #55

Closed lewang closed 10 years ago

lewang commented 10 years ago

I'm seeing this with a countdown timer.

wimbarelds commented 10 years ago

When does it happen? Is it a callback that's immediately after, or any time later?

The internal reqeustAnimationFrame loop should be stopped, so at most it should only have 1 more frame to trigger such a callback. I should probably remove it entirely, but it'd be good to know when this is happening.

lewang commented 10 years ago

I continue to get callbacks every second until timer goes down to 0.

On Mon, Jul 7, 2014 at 12:40 PM, wimbarelds notifications@github.com wrote:

When does it happen? Is it a callback that's immediately after, or any time later?

The internal reqeustAnimationFrame loop should be stopped, so at most it should only have 1 more frame to trigger such a callback. I should probably remove it entirely, but it'd be good to know when this is happening.

— Reply to this email directly or view it on GitHub https://github.com/wimbarelds/TimeCircles/issues/55#issuecomment-48203721 .

Le

wimbarelds commented 10 years ago

For some reason cancelAnimationFrame doesn't seem to be working properly, I'm changing it so the update function checks this.data.paused before queuing another frame.

[edit] Actually... That was probably causing the problem. The next frame was queued after the eventListeners were fired. If the eventListeners called .stop() and through that triggered cancelAnimationFrame-- after all that happened it would continue with the rest of the update function, which would start the whole thing back up. That should be fixed now anyway.

wimbarelds commented 10 years ago

Did a release, let me know if you still have any problems.