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)
        })
    }
}
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

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

wait/delay function
Was this helpful?
0 Comments