MCPcopy Create free account
hub / github.com/angular/angular / drainMicroTaskQueueSynchronously

Function drainMicroTaskQueueSynchronously

packages/zone.js/lib/zone-impl.ts:1547–1580  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1545 }
1546
1547 function drainMicroTaskQueueSynchronously() {
1548 if (_isDrainingMicrotaskQueue) {
1549 return;
1550 }
1551
1552 _isDrainingMicrotaskQueue = true;
1553
1554 try {
1555 while (_microTaskQueue.length) {
1556 const queue = _microTaskQueue;
1557 _microTaskQueue = [];
1558
1559 for (const task of queue) {
1560 try {
1561 task.zone.runTask(task, null, null);
1562 } catch (error) {
1563 _api.onUnhandledError(error as Error);
1564 }
1565 }
1566 }
1567 } finally {
1568 // The order matters!
1569 if (global[enableNativeMicrotaskDraining]) {
1570 _isDrainingMicrotaskQueue = false;
1571 _api.microtaskDrainDone();
1572 } else {
1573 try {
1574 _api.microtaskDrainDone();
1575 } finally {
1576 _isDrainingMicrotaskQueue = false;
1577 }
1578 }
1579 }
1580 }
1581
1582 //////////////////////////////////////////////////////
1583 //////////////////////////////////////////////////////

Callers 1

invokeTaskMethod · 0.85

Calls 1

runTaskMethod · 0.65

Tested by

no test coverage detected