yjhjstz / deep-into-node

In-depth understanding of Node.js: Core Ideas and Source Code Analysis
https://jianghua-yjhs-organization.gitbook.io/in-depth-understanding-of-node.js-core-ideas-and/
4.36k stars 624 forks source link

nodejs 和浏览器事件循环实现有什么区别? #9

Closed wmzy closed 7 years ago

wmzy commented 7 years ago

nodejs 和浏览器(比如chrome)在事件循环的实现有没有什么不同?能详细讲一下么?

yjhjstz commented 7 years ago

先看图 chrome: 3259161542-575018ce29d44_articlex

nodejs 和 chrome 的事件驱动实现上:

node.js 事件由 libuv 驱动,chrome 由 webkit 实现。

rawbin- commented 7 years ago

nodejs 使用v8 作为JavaScript解析,同样的chrome 内核 webkit 也是用v8作为JavaScript解析 nodejs 使用libuv,chrome 难道不是么?

hyj1991 commented 7 years ago

@rawbin- 浏览器不用 libuv

rawbin- commented 7 years ago

那在哪里可以看得到,浏览器用的什么库或者怎么实现的呢?

yjhjstz commented 7 years ago

clone webkit 看看