SetTimeOut

Post Reply
MTswitch
Newbie
Posts: 12
Joined: Fri Aug 23, 2019 3:18 pm

SetTimeOut

Post by MTswitch »

Hi,
i wolud like to ask, how can i use setTimeout
i wrote a for loop and setTimeout must be performed at the loop and every one second a msg log comes in log

Code: Select all

for (var i = 0; i < 3; i++) {
  (function (index) {
    setTimeout(function () {
    await job.log(LogLevel.Info,index);
    }, index * 5000);
  })(i);
}
i get an error message " await is only valid in async function " and without await comes any log
Post Reply