1 decade ago by coreysnyder
I think I've found an inconsistency between how JS runs in the browser vs how it runs inside of my Ejecta Project. It involves SetTimeout
Here's how my code worked in the browser. Every 50ms it would call my function. It appears that the scope is different when this code executes when using Ejecta. The code never executes.
So I tried using an anonymous function to create a closure of the scope so it exists when executing. This works.
Anyone else experience this?
Here's how my code worked in the browser. Every 50ms it would call my function. It appears that the scope is different when this code executes when using Ejecta. The code never executes.
setTimeout("countup("+count+", "+total+")", 50);
So I tried using an anonymous function to create a closure of the scope so it exists when executing. This works.
setTimeout(function(){ countup(count, total) }, 50);
Anyone else experience this?