Typescript vs LUA questions

It doesn’t exist. Create your own function that returns a promise that has a timeout.

Delay = (ms) => new Promise(res => setTimeout(res, ms));

I usually add this in some sort of utils file.

// utils.ts
Delay = (ms) => new Promise(res => setTimeout(res, ms));

export { Delay };

// somewhere.ts
import { Delay } from './utils';

setTick(async () => 
{
    await Delay(1000);
    console.log('hi');
})
3 Likes