sleep() function in JavaScript
Wednesday, January 6th, 2010JavaScript doesn't have a handy sleep() or wait() or delay() function to pause the execution for a few seconds, so we can use setTimeout() function to emulate such behaviour. It's not straightforward and may require you to refactor the workflow, but it's delaying the execution and is really simple:
JAVASCRIPT:
-
setTimeout(start, 1000);
-
var i = 0;
-
-
function start() {
-
console.log('i am here ' + i);
-
i++;
-
setTimeout(start, 1000);
-
}
Isn't this me-too RIA buzz a little bit naive? A long time ago Java "invented" applets - a great idea for RIA that has gracefully failed. Flash has taken the seat. MS's silverlight is not getting developers anywhere for too many reasons. JavaFX requires the latest Java JVM installed on the user's computer. I believe in the power of the Sun, but the UI is not their strongest side. Flex is the only way to go if you want to have a good-looking RIA application. Almost everybody has it installed and it is a really quick download if you don't have it. Great look, nice cooperation with J2EE technology.
Entries (RSS)
Comments (RSS)