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.
thread.sleep(ms)
My use case
With RxJS:
RxJS
import { timer } from 'rxjs'; // ... timer(your_delay_in_ms).subscribe(x => { your_action_code_here })
x is 0.
x
If you give a second argument period to timer, a new number will be emitted each period milliseconds (x = 0 then x = 1, x = 2, ...).
period
timer
See the official doc for more details.