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