Skip to content

Instantly share code, notes, and snippets.

@shiwano
Created December 30, 2012 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiwano/4412975 to your computer and use it in GitHub Desktop.
Save shiwano/4412975 to your computer and use it in GitHub Desktop.
(function () {
function sleep(time) {
var d1 = new Date().getTime();
var d2 = new Date().getTime();
while(d2 < d1 + time) {
d2 = new Date().getTime();
}
return;
}
var count = 0;
setInterval(function () {
sleep(1000);
count += 1;
console.log(count);
}, 10);
return;
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment