Typescript sleep

前端 未结 7 568
后悔当初
后悔当初 2020-11-30 20:02

I\'m developing a website in Angular 2 using Typescript and I was wondering if there was a way to implement thread.sleep(ms) functionality.

My use case

7条回答
  •  心在旅途
    2020-11-30 20:32

    Or rather than to declare a function, simply:

    setTimeout(() => {
        console.log('hello');
    }, 1000);
    

提交回复
热议问题