(root, expirationTime)
| 12965 | // requestWork is called by the scheduler whenever a root receives an update. |
| 12966 | // It's up to the renderer to call renderRoot at some point in the future. |
| 12967 | function requestWork(root, expirationTime) { |
| 12968 | addRootToSchedule(root, expirationTime); |
| 12969 | |
| 12970 | if (isRendering) { |
| 12971 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 12972 | // the currently rendering batch. |
| 12973 | return; |
| 12974 | } |
| 12975 | |
| 12976 | if (isBatchingUpdates) { |
| 12977 | // Flush work at the end of the batch. |
| 12978 | if (isUnbatchingUpdates) { |
| 12979 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 12980 | // flush it now. |
| 12981 | nextFlushedRoot = root; |
| 12982 | nextFlushedExpirationTime = Sync; |
| 12983 | performWorkOnRoot(root, Sync, false); |
| 12984 | } |
| 12985 | return; |
| 12986 | } |
| 12987 | |
| 12988 | // TODO: Get rid of Sync and use current time? |
| 12989 | if (expirationTime === Sync) { |
| 12990 | performSyncWork(); |
| 12991 | } else { |
| 12992 | scheduleCallbackWithExpiration(expirationTime); |
| 12993 | } |
| 12994 | } |
| 12995 | |
| 12996 | function addRootToSchedule(root, expirationTime) { |
| 12997 | // Add the root to the schedule. |
no test coverage detected