I want to add a little interaction on a page that acts kind of like a very simple bot.
How can I simulate a little time delay like you see in bots? (when it shows a 'typing...' indicator or that image with dots that animates).
I want to add a little interaction on a page that acts kind of like a very simple bot.
How can I simulate a little time delay like you see in bots? (when it shows a 'typing...' indicator or that image with dots that animates).
You can use setTimeout
like below.
startDelay = (timeDelay) => {
console.log(`It's time to go`);
setTimeout(() => {
console.log('I wake up');
}, timeDelay);
};
startDelay(3000);