packages/react-reconciler/src/ReactFiberRoot.js

类型

export type Batch = {_defer: boolean,_expirationTime: ExpirationTime,_onComplete: () => mixed,_next: Batch | null,
};export type PendingInteractionMap = Map<ExpirationTime, Set<Interaction>>;type BaseFiberRootProperties = {|// Any additional information from the host associated with this root.containerInfo: any,// Used only by persistent updates.pendingChildren: any,// The currently active root fiber. This is the mutable root of the tree.current: Fiber,// The following priority levels are used to distinguish between 1)// uncommitted work, 2) uncommitted work that is suspended, and 3) uncommitted// work that may be unsuspended. We choose not to track each individual// pending level, trading granularity for performance.//// The earliest and latest priority levels that are suspended from committing.earliestSuspendedTime: ExpirationTime,latestSuspendedTime: ExpirationTime,// The earliest and latest priority levels that are not known to be suspended.earliestPendingTime: ExpirationTime,latestPendingTime: ExpirationTime,// The latest priority level that was pinged by a resolved promise and can// be retried.latestPingedTime: ExpirationTime,pingCache:| WeakMap<Thenable, Set<ExpirationTime>>| Map<Thenable, Set<ExpirationTime>>| null,// If an error is thrown, and there are no more updates in the queue, we try// rendering from the root one more time, synchronously, before handling// the error.didError: boolean,pendingCommitExpirationTime: ExpirationTime,// A finished work-in-progress HostRoot that's ready to be committed.finishedWork: Fiber | null,// Timeout handle returned by setTimeout. Used to cancel a pending timeout, if// it's superseded by a new one.timeoutHandle: TimeoutHandle | NoTimeout,// Top context object, used by renderSubtreeIntoContainercontext: Object | null,pendingContext: Object | null,// Determines if we should attempt to hydrate on the initial mount+hydrate: boolean,// Remaining expiration time on this root.// TODO: Lift this into the renderernextExpirationTimeToWorkOn: ExpirationTime,expirationTime: ExpirationTime,// List of top-level batches. This list indicates whether a commit should be// deferred. Also contains completion callbacks.// TODO: Lift this into the rendererfirstBatch: Batch | null,// Linked-list of rootsnextScheduledRoot: FiberRoot | null,
|};type ProfilingOnlyFiberRootProperties = {|interactionThreadID: number,memoizedInteractions: Set<Interaction>,pendingInteractionMap: PendingInteractionMap,
|};// Exported FiberRoot type includes all properties,
// To avoid requiring potentially error-prone :any casts throughout the project.
// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
// The types are defined separately within this file to ensure they stay in sync.
// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
export type FiberRoot = {...BaseFiberRootProperties,...ProfilingOnlyFiberRootProperties,
};复制代码

createFiberRoot

export function createFiberRoot(containerInfo: any,isConcurrent: boolean,hydrate: boolean,
): FiberRoot {// Cyclic construction. This cheats the type system right now because// stateNode is any.const uninitializedFiber = createHostRootFiber(isConcurrent);let root;if (enableSchedulerTracing) {root = ({current: uninitializedFiber,containerInfo: containerInfo,pendingChildren: null,earliestPendingTime: NoWork,latestPendingTime: NoWork,earliestSuspendedTime: NoWork,latestSuspendedTime: NoWork,latestPingedTime: NoWork,pingCache: null,didError: false,pendingCommitExpirationTime: NoWork,finishedWork: null,timeoutHandle: noTimeout,context: null,pendingContext: null,hydrate,nextExpirationTimeToWorkOn: NoWork,expirationTime: NoWork,firstBatch: null,nextScheduledRoot: null,interactionThreadID: unstable_getThreadID(),memoizedInteractions: new Set(),pendingInteractionMap: new Map(),}: FiberRoot);} else {root = ({current: uninitializedFiber,containerInfo: containerInfo,pendingChildren: null,pingCache: null,earliestPendingTime: NoWork,latestPendingTime: NoWork,earliestSuspendedTime: NoWork,latestSuspendedTime: NoWork,latestPingedTime: NoWork,didError: false,pendingCommitExpirationTime: NoWork,finishedWork: null,timeoutHandle: noTimeout,context: null,pendingContext: null,hydrate,nextExpirationTimeToWorkOn: NoWork,expirationTime: NoWork,firstBatch: null,nextScheduledRoot: null,}: BaseFiberRootProperties);}uninitializedFiber.stateNode = root;// The reason for the way the Flow types are structured in this file,// Is to avoid needing :any casts everywhere interaction tracing fields are used.// Unfortunately that requires an :any cast for non-interaction tracing capable builds.// $FlowFixMe Remove this :any cast and replace it with something better.return ((root: any): FiberRoot);
}
复制代码

转载于:https://juejin.im/post/5d1a163e6fb9a07ee0632f47

React 深度学习:ReactFiberRoot相关推荐

  1. React 深度学习:ReactFiberLazyComponent

    path: packages/react-reconciler/src/ReactFiberLazyComponent.js resolveDefaultProps 解析默认 props export ...

  2. React 深度学习:ReactFiber

    packages/react-reconciler/src/ReactFiber.js Fiber // A Fiber is work on a Component that needs to be ...

  3. React 深度学习:invariant

    path: packages/shared/invariant.js 源码 /*** 根据条件抛出固定格式的错误,允许使用 %s 作为变量的占位符* * @param condition* @para ...

  4. 迁移学习,让深度学习不再困难……

    2020-03-02 17:01:00 全文共2968字,预计学习时长9分钟 来源:Pexels 在不远的过去,数据科学团队需要一些东西来有效地利用深度学习: · 新颖的模型架构,很可能是内部设计的 ...

  5. “深度学习一点也不难!”

    2020-02-14 11:11:15 通常情况下,机器学习尤其是深度学习的使用往往需要具备相当的有利条件,包括一个大型的数据集,设计有效的模型,而且还需要训练的方法--但现在,利用迁移学习就可以消除 ...

  6. 深度学习:在图像上找到手势_使用深度学习的人类情绪和手势检测器:第2部分

    深度学习:在图像上找到手势 情感手势检测 (Emotion Gesture Detection) Hello everyone! Welcome back to the part-2 of human ...

  7. 机器学习 深度学习 ai_人工智能,机器学习,深度学习-特征和差异

    机器学习 深度学习 ai Artificial Intelligence (AI) will and is currently taking over an important role in our ...

  8. 如何在TensorFlow中通过深度学习构建年龄和性别的多任务预测器

    by Cole Murray 通过科尔·默里(Cole Murray) In my last tutorial, you learned about how to combine a convolut ...

  9. 深度学习去燥学习编码_通过编码学习编码

    深度学习去燥学习编码 "Teach Yourself to program in 10 years." That's how Peter Norvig - a Berkeley p ...

  10. 媒智科技--深度学习算法Python后台开发--热招中~

    点击我爱计算机视觉标星,更快获取CVML新技术 公司简介 媒智科技源起于上海交通大学,核心团队由上海交大.清华.斯坦福.乔治亚理工等顶尖高校的人工智能教授,以及来自雅虎.腾讯等科技精英组成,聚焦计算机 ...

最新文章

  1. Graph2Vec在XFL论文中提及的用处
  2. 深入理解Python闭包概念
  3. selenium search
  4. 【机器学习基础】数学推导+纯Python实现机器学习算法23:kmeans聚类
  5. 基于Hbase的用户评分协同过滤推荐算法
  6. 2021-04-22 宠店流程图
  7. 50个最有价值的数据可视化图表
  8. Vs2019 C# .net core 将证书添加到受信任的根证书存储失败,出现以下错误:访问控制列表(ACL)结构无效...
  9. Hibernate 注解(Annotations 一)
  10. 爆牙齿的世界杯日记(忆)。
  11. 组态王怎么做进度条_3分钟学会超实用||进度条amp;游戏血条的制作方法!
  12. Ubunu16.04安装CPU版本Tensorflow
  13. IEC60870-5-103规约通讯过程
  14. 图像处理之直方图匹配
  15. uniapp小程序体验版-白屏现象
  16. 《中华人民共和国数据安全法》解读(1)
  17. 1155低功耗cpu排行_低功耗是亮点 Intel第三代酷睿CPU评测
  18. 以前的windows安装文件可以删除吗_你知道C盘哪些文件是可以删除吗?
  19. 新闻资讯APP开发成本需要多少钱?
  20. 弱一致性、CAP、BASE与NoSQL

热门文章

  1. Android类加载器和热修复原理
  2. 为什么我不建议你用去 “ ! = null “ 做判空?
  3. python基础篇——简单编码与解码的战争
  4. .ajax 上传图片,ajax图片上传并预览
  5. linux 防火墙 qt udp,使用Qt实现简单的udp/ip通信
  6. python---windows中的文件路径书写的错误
  7. linux apt get 无效,kail Linux apt-get失败解决方案
  8. rdp如何禁止映射本地磁盘_什么是磁盘阵列?什么是NAS?该怎么选择?
  9. matlab中如何画零线,不接零线的教训好惨 - 通信工程设计与建设 - 通信人家园 - Powered by C114...
  10. pythonsocket中tcp通信接收不到数据_通信中数据发生错误,接收方如何判决?检错码与纠错码必不可少...