Jump to content


ticker missing callbacks when adding callbacks on a callback

Go to solution Solved by GreenSock,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Ran into an issue this evening.


If adding a callback to the ticker during a different ticker callback, there is a chance the ticker will miss some of the callbacks already scheduled.


In the console output for the pen, notice that a callback with priority 1 is skipped on frame 30.


I have implemented a hotfix of my own for this issue by modifying the TweenMax source for dispatchEvent.  I clone the list with a list.slice(0); before iterating through it.   New listeners will not be added until the next tick, but that is understandable behavior.


Thanks for looking into this.

See the Pen GqJadb?editors=0010 by jedierikb (@jedierikb) on CodePen

Link to comment
Share on other sites

  • Solution

I see what you mean, but that's only necessary if the length is greater than 1. Skipping it in that case (1) allows us to improve performance for the vast majority of users (when people don't add extra "tick" listeners). https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.