Page 1 of 1

SetTimeOut

Posted: Fri Oct 09, 2020 1:06 pm
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