Function: timer()
timer(
ms):Timer
Create a Task which will resolve to the number of milliseconds the timer waited for that time elapses. (In other words, it safely wraps the setTimeout function.)
This can be used as a “timeout” by calling it in conjunction any of the Task helpers like all, race, and so on. As a convenience to use it as a timeout for another task, you can also combine it with the Task.timeout instance method or the standalone timeout function.
Provides the requested duration of the timer in case it is useful for working with multiple timers.
Parameters
ms
number
The number of milliseconds to wait before resolving the Task.
Returns
a Task which resolves to the passed-in number of milliseconds.