学习node 核心
最大最容易误解的功能 流是有几个不同的对象附着的接口
这就是所谓的 Virtual DOM 算法。包括几个步骤: 1, 用 JavaScript 对象结构表示 DOM 树的结构; 2, 然后用这个树构建一个真正的 DOM 树,插到文档当中当状态变更的时候,重新构造一棵新的对象树。 然后用新的树和旧的树进行比较,记录两棵树差异 3,把2所记录的差异应用到步骤1所构建的真正的DOM树上,视图就更新了
Virtual DOM 本质上就是在 JS 和 DOM 之间做了一个缓存。 可以类比 CPU 和硬盘,既然硬盘这么慢,我们就在它们之间加个缓存:既然 DOM 这么慢,我们就在它们 JS 和 DOM 之间加个缓存。CPU(JS)只操作内存(Virtual DOM),最后的时候再把变更写入硬盘(DOM)。
1,node本身就是一个命令行工具 2,设置默认的运行时 3,使用chmod分配执行权限 4,设置环境变量