Skip to content

Instantly share code, notes, and snippets.

@riix
Created December 18, 2012 04:32
Show Gist options
  • Save riix/4325027 to your computer and use it in GitHub Desktop.
Save riix/4325027 to your computer and use it in GitHub Desktop.
setTimeout 사용법
function targetfunction(){
//ToDo
}
function timerFunction(){
if(index <20 ){
//20회 미만이면 실행
targetfunction();
index++;
timerVar = setTimeout("timerFunction", 1000); //재귀로 settimeout 돌림
} else {
clearTimeout(timerVar )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment