填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

flush

通过清空宏任务队列直到其为空,来为 fakeAsync Zone 中的计时器模拟异步时间流逝。返回的值是本应经过的毫秒数。

Simulates the asynchronous passage of time for the timers in the fakeAsync zone by draining the macrotask queue until it is empty. The returned value is the milliseconds of time that would have been elapsed.

      
      flush(maxTurns?: number): number
    
参数
maxTurns number
可选. 默认值是 `undefined`.
返回值

已流逝的模拟时间(以毫秒为单位)。

number: The simulated time elapsed, in millis.