Browse files

Ported 'countdown.js' to PhantomJS 1.2

  • Loading branch information...
1 parent b91f5b9 commit 811c56b6f3a86e9235524435d79b2700c0b70b8a @detro detro committed Jun 1, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 examples/countdown.js
View
17 examples/countdown.js
@@ -1,8 +1,9 @@
-var t = 10;
-while (t > 0) {
- console.log(t);
- phantom.sleep(1000);
- t = t - 1;
-}
-console.log('BLAST OFF');
-phantom.exit();
+var t = 10,
+ interval = setInterval(function(){
+ if ( t > 0 ) {
+ console.log(t--);
+ } else {
+ console.log("BLAST OFF!");
+ phantom.exit();
+ }
+ }, 1000);

0 comments on commit 811c56b

Please sign in to comment.