Jump to content
Search Community

Infinitie setTimeOut calls by Tweenmax

Irfan Ali Qureshi test
Moderator Tag

Recommended Posts

Hi,

 

I am using tweenmax in my reactJs project and while working on the performance optimization, I ran the following script in console which shows the number of active setTimeOut calls.

 

window.originalSetTimeout = window.setTimeout;
window.originalClearTimeout = window.clearTimeout;
window.activeTimers = 0;

window.setTimeout = function(func, delay) {
window.activeTimers++;
console.log('> set', window.activeTimers);
return window.originalSetTimeout(func, delay);
};

window.clearTimeout = function(timerID) {
window.activeTimers--;
console.log('>> clear', window.activeTimers);
window.originalClearTimeout(timerID);
};

If we just import tweenmax, infinitive setTimeOut calls start getting triggered. We dont even have to use the library, just importing it alone causes so much action to calls. Can you please help me look into this issue?

Edited by Irfan Ali Qureshi
Link to comment
Share on other sites

I showed you where it's coming from. 

https://github.com/greensock/GSAP/blob/86b54d1c70237daeb754f6be8b5d9ee4f4c9cbe2/src/esm/TweenLite.js#L456

 

// some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user 
// switches to a different tab and then comes back again, so we use a 2-second setTimeout() 
// to sense if/when that condition occurs and then wake() the ticker.

 

That's v2. We're on v3 now. 

 

Link to comment
Share on other sites

19 minutes ago, Irfan Ali Qureshi said:

Here, I am using the latest version from cdn

 

And the "latest" version is not the latest. It's actually really old. version 1.18.0

 

This is the last version 2.

https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js

 

And this is the most recent version.

https://cdnjs.cloudflare.com/ajax/libs/gsap/3.0.1/gsap.min.js

 

  • Like 2
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.
×
×
  • Create New...