Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

flush

Flushes any pending microtasks and simulates the asynchronous passage of time for the timers in the fakeAsync zone by draining the macrotask queue until it is empty.

      
      flush(maxTurns?: number): number
    
Parameters
maxTurns number

The maximum number of times the scheduler attempts to clear its queue before throwing an error.

Optional. Default is undefined.

Returns

number: The simulated time elapsed, in milliseconds.