(root, expirationTime)
| 13697 | // requestWork is called by the scheduler whenever a root receives an update. |
| 13698 | // It's up to the renderer to call renderRoot at some point in the future. |
| 13699 | function requestWork(root, expirationTime) { |
| 13700 | addRootToSchedule(root, expirationTime); |
| 13701 | |
| 13702 | if (isRendering) { |
| 13703 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 13704 | // the currently rendering batch. |
| 13705 | return; |
| 13706 | } |
| 13707 | |
| 13708 | if (isBatchingUpdates) { |
| 13709 | // Flush work at the end of the batch. |
| 13710 | if (isUnbatchingUpdates) { |
| 13711 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 13712 | // flush it now. |
| 13713 | nextFlushedRoot = root; |
| 13714 | nextFlushedExpirationTime = Sync; |
| 13715 | performWorkOnRoot(root, Sync, false); |
| 13716 | } |
| 13717 | return; |
| 13718 | } |
| 13719 | |
| 13720 | // TODO: Get rid of Sync and use current time? |
| 13721 | if (expirationTime === Sync) { |
| 13722 | performSyncWork(); |
| 13723 | } else { |
| 13724 | scheduleCallbackWithExpiration(expirationTime); |
| 13725 | } |
| 13726 | } |
| 13727 | |
| 13728 | function addRootToSchedule(root, expirationTime) { |
| 13729 | // Add the root to the schedule. |
no test coverage detected