(root, expirationTime)
| 13639 | // requestWork is called by the scheduler whenever a root receives an update. |
| 13640 | // It's up to the renderer to call renderRoot at some point in the future. |
| 13641 | function requestWork(root, expirationTime) { |
| 13642 | addRootToSchedule(root, expirationTime); |
| 13643 | |
| 13644 | if (isRendering) { |
| 13645 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 13646 | // the currently rendering batch. |
| 13647 | return; |
| 13648 | } |
| 13649 | |
| 13650 | if (isBatchingUpdates) { |
| 13651 | // Flush work at the end of the batch. |
| 13652 | if (isUnbatchingUpdates) { |
| 13653 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 13654 | // flush it now. |
| 13655 | nextFlushedRoot = root; |
| 13656 | nextFlushedExpirationTime = Sync; |
| 13657 | performWorkOnRoot(root, Sync, false); |
| 13658 | } |
| 13659 | return; |
| 13660 | } |
| 13661 | |
| 13662 | // TODO: Get rid of Sync and use current time? |
| 13663 | if (expirationTime === Sync) { |
| 13664 | performSyncWork(); |
| 13665 | } else { |
| 13666 | scheduleCallbackWithExpiration(expirationTime); |
| 13667 | } |
| 13668 | } |
| 13669 | |
| 13670 | function addRootToSchedule(root, expirationTime) { |
| 13671 | // Add the root to the schedule. |
no test coverage detected