Using Settimeout() For Large Values
I'm trying to get an event to fire after five minutes. I'm using the following code: setTimeout(tweet(name, type), 5 * 60 * 1000); It is firing after a while, but not nearly five
Solution 1:
You are calling tweet
immediately and passing its return value to setTimeout
.
You need to pass a function to setTimeout
. You haven't included the code for tweet
, but I'm going to assume that it doesn't return
a function.
setTimeout(function () { tweet(name, type); }, 5 * 60 * 1000);
Post a Comment for "Using Settimeout() For Large Values"