setTimeout() replacement

Status: Open · Asked by Yaniv Kirshon on · 0 views

Yan — Question ·

Hi there,
now that setTimeout() is restricted (since 2nd Feb), what are the alternatives to create a delay for seconds?
So far, a code step was my only option to create this...
I know there's the delay app (pabbly), however it doesn't support seconds units - only minutes, hours, days etc. So it's not an option.

Would you add an option for seconds as a unit in the delay app?
otherwise, what are my options for having a few seconds delay?

Thank you

Preeti Paryani — Reply ·

Hey @Yan,

You can use this JavaScript code instead:

const delaySeconds = 20;
const start = Date.now();

while (Date.now() - start < delaySeconds * 1000) {
// wait
}

output = [{ wait: delaySeconds + " seconds" }];

Back to all forum threads · Log in to reply