Sindar
Sindar

Reputation: 10839

Set Time out by passing a parameter

i'm currently have a problem by using the SetTimeOut function.

The thing is that i need to use it by passing a parameter, but it didn't work... Here is the code :

function RSSChecker(dMObject)
{
    if (dMObject) 
    {
        alert('Refresh');
        window.setTimeout(RSSChecker(dMObject), 10000);
    }
}

Any ideas?

Upvotes: 0

Views: 228

Answers (1)

tinyd
tinyd

Reputation: 952

Another approach would be to wrap the inner call in an anonymous function that invokes your function. So that you have:-

window.setTimeout(function() { RSSChecker(dmObject); }, 10000);

Upvotes: 4

Related Questions