Friday, August 4, 2017

setTimeout is of super lazy, bad JavaScript coding.

If you cannot use a callback/promise set an interval or timer that loops against a low number of ticks like five hundred (a half of a second) and then cleans itself up once it affirms that the thing it was waiting on has happened. Do not just wait a long time and then assume the thing you were waiting on has happened like this:

doSomethingAsynchronous();
setTimeout(function(){ goOnToTheNextThing(); }, 3000);

No comments:

Post a Comment