본문 바로가기

Web/Javascript

javascript 타이머

특정 시간(cycleSecond ) 마다 반복 실행



var cycleSecond = 5; // 주기 (초)


setInterval(function() {

           event(); //이벤트

 },cycleSecond*1000);





특정 시간(cycleSecond ) 이후 이벤트 발생

function timer_event(){

     event(); //이벤트

}


setTimeout(timer_event(), cycleSecond*1000);


'Web > Javascript' 카테고리의 다른 글

centos apache 에서 vue router history mod가 안될때  (0) 2019.01.21