functionrequestCurrentTime(){
// 这里,我把官方注释移除// 这里表示 已经进入到 渲染阶段 了,在 ReactDOM.render 中这里不会匹配,会跳过// 在一次render中,如果我有一个新的任务进来了,要计算 expirationTime 发现现在处于渲染阶段,这时直接返回上次 render 开始的时间,再去计算 expirationTime// 好处是 前后两次计算出来的 expirationTime 是一样的,让这个任务提前进行调度if(isRendering){
// We're already rendering. Return the most recently read time.return currentSchedulerTime;}// Check if there's pending work.findHighestPriorityRoot();// 刚初始化的时候,这个条件是成立的if(
nextFlushedExpirationTime === NoWork ||
nextFlushedExpirationTime === Never
){
// If there's no pending work, or if the pending work is offscreen, we can// read the current time without risk of tearing.recomputeCurrentRendererTime();
currentSchedulerTime = currentRendererTime;// 两个常量划等号return currentSchedulerTime;}// 这里,我把官方注释移除return currentSchedulerTime;}