Search code snippets, questions, articles...

wait/delay function

wait/delay function. Timeout
method: {
    async function() {
        //first action
        await this.timeout(3000);//delay
        //second action
    },
    timeout(ms) {
        return new Promise(resolve => {
            window.setTimeout(resolve, ms)
        })
    }
}

Search Index Data (The code snippet can also be found with below search text)

wait/delay function
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet