I'd like to wait 1 minute and then execute a function f(). I have found out that in Javascript there isn't a sleep() function but I can use setInterval() or setTimeout() functions.
The window.setInterval() function works, but this is not what I want. I want to execute f() only once. I tried to use the setTimeout() function as follows.
var MyNamespace {
...
f: function() {
},
...
click: function() {
...
setTimeout("this.f()", 60000); // f() is never executed
// setTimeout(this.f(), 60000); f() is executed immediately without timeout
// window.setTimeout(...) doesn't help
},
...
}
What could be wrong here?
The code is part of a Firefox extension.