(root, expirationTime)
| 12928 | // requestWork is called by the scheduler whenever a root receives an update. |
| 12929 | // It's up to the renderer to call renderRoot at some point in the future. |
| 12930 | function requestWork(root, expirationTime) { |
| 12931 | addRootToSchedule(root, expirationTime); |
| 12932 | |
| 12933 | if (isRendering) { |
| 12934 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 12935 | // the currently rendering batch. |
| 12936 | return; |
| 12937 | } |
| 12938 | |
| 12939 | if (isBatchingUpdates) { |
| 12940 | // Flush work at the end of the batch. |
| 12941 | if (isUnbatchingUpdates) { |
| 12942 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 12943 | // flush it now. |
| 12944 | nextFlushedRoot = root; |
| 12945 | nextFlushedExpirationTime = Sync; |
| 12946 | performWorkOnRoot(root, Sync, false); |
| 12947 | } |
| 12948 | return; |
| 12949 | } |
| 12950 | |
| 12951 | // TODO: Get rid of Sync and use current time? |
| 12952 | if (expirationTime === Sync) { |
| 12953 | performSyncWork(); |
| 12954 | } else { |
| 12955 | scheduleCallbackWithExpiration(expirationTime); |
| 12956 | } |
| 12957 | } |
| 12958 | |
| 12959 | function addRootToSchedule(root, expirationTime) { |
| 12960 | // Add the root to the schedule. |
no test coverage detected