填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫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.