I’m trying to call an instance’s method with a delay of 750ms. The problem is, it doesn’t work. I’ve read that there’s some sort of problem with setInterval and objects so probably there’s one with setTimeout as well.
Say I have this:
function App()
{
this.doFoo = function (arg)
{
alert("bar");
}
}
window.app = new App();
setTimeout('app.doFoo(arg)', 750);//doesn't work
app.doFoo(arg); //works
Is there a workaround? How do I go about passing the instance and function to setTimeout?
Try like this: