Skip to content

Commit 5a79774

Browse files
committed
references
1 parent d04be92 commit 5a79774

File tree

3 files changed

+385
-33
lines changed

3 files changed

+385
-33
lines changed

Notes/NodeJS/Articles.md

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [Articles](#articles)
6+
- [Node.js](#nodejs)
7+
- [模块](#%E6%A8%A1%E5%9D%97)
8+
- [进程/线程](#%E8%BF%9B%E7%A8%8B%E7%BA%BF%E7%A8%8B)
9+
- [事件循环](#%E4%BA%8B%E4%BB%B6%E5%BE%AA%E7%8E%AF)
10+
- [**V8**](#v8)
11+
- [其他](#%E5%85%B6%E4%BB%96)
12+
- [JavaScript](#javascript)
13+
- [基础](#%E5%9F%BA%E7%A1%80)
14+
- [**How JavaScript works**](#how-javascript-works)
15+
- [Promise](#promise)
16+
- [前端](#%E5%89%8D%E7%AB%AF)
17+
- [其他](#%E5%85%B6%E4%BB%96-1)
18+
- [Redis](#redis)
19+
- [知识点](#%E7%9F%A5%E8%AF%86%E7%82%B9)
20+
- [其他](#%E5%85%B6%E4%BB%96-2)
21+
- [计算机](#%E8%AE%A1%E7%AE%97%E6%9C%BA)
22+
- [计算机网络](#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C)
23+
- [TCP/UDP](#tcpudp)
24+
- [HTTPS](#https)
25+
- [SSH](#ssh)
26+
- [DNS/CDN](#dnscdn)
27+
- [网络攻击](#%E7%BD%91%E7%BB%9C%E6%94%BB%E5%87%BB)
28+
- [算法和数据结构](#%E7%AE%97%E6%B3%95%E5%92%8C%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84)
29+
- [算法](#%E7%AE%97%E6%B3%95)
30+
- [难点](#%E9%9A%BE%E7%82%B9)
31+
- [数据结构](#%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84)
32+
- [架构](#%E6%9E%B6%E6%9E%84)
33+
- [消息队列](#%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97)
34+
- [微服务](#%E5%BE%AE%E6%9C%8D%E5%8A%A1)
35+
- [运维](#%E8%BF%90%E7%BB%B4)
36+
- [其他](#%E5%85%B6%E4%BB%96-3)
37+
38+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
39+
40+
41+
## Articles
42+
43+
### Node.js
44+
45+
#### 模块
46+
47+
- [深入学习 Node.js Module](https://semlinker.com/node-module/)
48+
- [Node.js 中的循环依赖](https://cnodejs.org/topic/567104f61d2912ce2a35aa88)
49+
- [浅析 NodeJs 的几种文件路径](https://github.com/imsobear/blog/issues/48)
50+
- [Node.js module.exports vs. exports](https://www.freecodecamp.org/news/node-js-module-exports-vs-exports-ec7e254d63ac/)
51+
- [module.exports vs exports in Node.js](https://stackoverflow.com/questions/7137397/module-exports-vs-exports-in-node-js)
52+
53+
#### 进程/线程
54+
55+
- [浅析 Node 进程与线程](https://juejin.im/post/5e0728ce518825122b0f99f2)
56+
- [NodeJS 充分利用多核 CPU 以及它的稳定性](https://segmentfault.com/a/1190000007343993)
57+
- [当我们谈论 cluster 时我们在谈论什么](https://github.com/hustxiaoc/node.js/issues/11)
58+
- [NodeJS 多进程](https://segmentfault.com/a/1190000004621734)
59+
- [Node.js 软肋之 CPU 密集型任务](https://www.infoq.cn/article/nodejs-weakness-cpu-intensive-tasks/)
60+
- [[] Node.js 的线程和进程详解](https://github.com/xiongwilee/blog/issues/9)
61+
62+
#### 事件循环
63+
64+
事件循环/任务调度
65+
66+
- [The JavaScript Event Loop: Explained](https://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/)
67+
- [Concurrency model and the event loop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop)
68+
- [【译】【Node.js at Scale】理解 Node.js 中的事件循环](./Node.js-at-Scale/)
69+
- [Tasks, microtasks, queues and schedules](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/)
70+
71+
setTimeout 问题
72+
73+
- [Difference between setTimeout(fn, 0) and setTimeout(fn, 1)?](https://stackoverflow.com/questions/8341803/difference-between-settimeoutfn-0-and-settimeoutfn-1)
74+
- [Why is setTimeout(fn, 0) sometimes useful?](https://stackoverflow.com/questions/779379/why-is-settimeoutfn-0-sometimes-useful)
75+
76+
#### **V8**
77+
78+
- [Speeding up spread elements](https://v8.dev/blog/spread-elements)
79+
- [Fast async](https://v8.dev/blog/fast-async)
80+
- [V8 引擎的垃圾回收策略](https://www.cnblogs.com/onepixel/p/7422820.html)
81+
- [【译】【Node.js at Scale】Node.js 的垃圾回收机制](./Node.js-at-Scale/)
82+
83+
#### 其他
84+
85+
- [Node.js Interview Questions and Answers !?](https://blog.risingstack.com/node-js-interview-questions-and-answers-2017/)
86+
- [深入学习 Node.js EventEmitter](https://semlinker.com/node-event-emitter/)
87+
- [深入理解 Node.js:核心思想与源码分析](https://github.com/yjhjstz/deep-into-node)
88+
89+
### JavaScript
90+
91+
- [The Modern JavaScript Tutorial](https://javascript.info/)
92+
- [Getting creative with the Console API!](https://areknawo.com/getting-creative-with-the-console-api/)
93+
94+
#### 基础
95+
96+
> 数据类型,原型/原型链
97+
98+
- [细说 JavaScript 七种数据类型](https://www.cnblogs.com/onepixel/p/5140944.html)
99+
- [JavaScript 中的四舍五入](https://www.cnblogs.com/onepixel/p/5141566.html)
100+
- [认识原型对象和原型链](https://www.cnblogs.com/onepixel/p/5024903.html)
101+
- [函数作用域和作用域链](https://www.cnblogs.com/onepixel/p/5036369.html)
102+
- [你不知道的 JavaScript](../JavaScript/你不知道的JavaScript)
103+
104+
> Map, WeakMap
105+
106+
- [Difference between Map and WeakMap in JavaScript](https://www.mattzeunert.com/2017/01/31/weak-maps.html)
107+
- [What are the actual uses of ES6 WeakMap?](https://stackoverflow.com/questions/29413222/what-are-the-actual-uses-of-es6-weakmap)
108+
- [带键的集合](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections)
109+
110+
> 判断操作
111+
112+
- [详解 undefined 与 null 的区别](https://www.cnblogs.com/onepixel/p/7337248.html)
113+
- [Why `null >= 0 && null <= 0` but not `null == 0`?](https://stackoverflow.com/questions/2910495/why-null-0-null-0-but-not-null-0)
114+
- [JavaScript 中的相等性判断](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Equality_comparisons_and_sameness)
115+
116+
#### **How JavaScript works**
117+
118+
1. [How JavaScript works: An overview of the engine, the runtime, and the call stack](https://blog.sessionstack.com/how-does-javascript-actually-work-part-1-b0bacc073cf)
119+
2. [How JavaScript works: Inside the V8 engine + 5 tips on how to write optimized code](https://blog.sessionstack.com/how-javascript-works-inside-the-v8-engine-5-tips-on-how-to-write-optimized-code-ac089e62b12e)
120+
3. [How JavaScript works: Memory management + how to handle 4 common memory leaks](https://blog.sessionstack.com/how-javascript-works-memory-management-how-to-handle-4-common-memory-leaks-3f28b94cfbec)
121+
4. [How JavaScript works: Event loop and the rise of Async programming + 5 ways to better coding with async/await](https://blog.sessionstack.com/how-javascript-works-event-loop-and-the-rise-of-async-programming-5-ways-to-better-coding-with-2f077c4438b5)
122+
5. [How JavaScript works: Storage engines + how to choose the proper storage API](https://blog.sessionstack.com/how-javascript-works-storage-engines-how-to-choose-the-proper-storage-api-da50879ef576)
123+
124+
#### Promise
125+
126+
- [JavaScript Promise 迷你书(中文版)](http://liubin.org/promises-book/)
127+
- [大白话讲解 Promise](https://www.cnblogs.com/lvdabao/p/es6-promise-1.html)
128+
- [How do Promises Work?](https://robotlolita.me/articles/2015/how-do-promises-work/)
129+
130+
#### 前端
131+
132+
- [前端高性能动画最佳实践](https://mp.weixin.qq.com/s?__biz=MjM5Njc0MjIwMA==&mid=401923510&idx=1&sn=daddf02e41981b5fc7d3eb62d9c3d891&scene=0#wechat_redirect)
133+
- [前端工程与性能优化](https://github.com/fouber/blog/issues/3)
134+
- [Should I use shouldComponentUpdate?](http://jamesknelson.com/should-i-use-shouldcomponentupdate/)
135+
- [傻傻分不清之 Cookie、Session、Token、JWT](https://juejin.im/post/5e055d9ef265da33997a42cc)
136+
- 事件冒泡 和 事件捕获
137+
- [https://juejin.im/post/5cc941436fb9a03236394027](https://juejin.im/post/5cc941436fb9a03236394027)
138+
- [https://segmentfault.com/a/1190000012729080](https://segmentfault.com/a/1190000012729080)
139+
140+
#### 其他
141+
142+
- [4 类 JavaScript 内存泄露及如何避免](https://juejin.im/entry/5742dc3471cfe4006c4e6c45/view)
143+
- [开开心心做几道 JavaScript 机试题](https://segmentfault.com/a/1190000005828394)
144+
- [44个 Javascript 变态题解析 (上\下)](http://ourjs.com/detail/5761040488feaf2d031d2526?utm_source=tuicool&utm_medium=referral)
145+
- [20个 Js 变态题解析](https://segmentfault.com/a/1190000005988554)
146+
- [JavaScript 数组乱序 - 洗牌问题](https://github.com/lessfish/underscore-analysis/issues/15)
147+
- [十几道含答案的大厂面试题总结](https://juejin.im/post/5e096d63e51d4558381e9906)
148+
149+
- deepcopy 实现
150+
- [What is the most efficient way to deep clone an object in JavaScript?](https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript)
151+
- [lodash.cloneDeep](https://github.com/lodash/https://github.com/lodash/lodash/blob/master/cloneDeep.js)
152+
- [deepcopy.js](https://github.com/sasaplus1/deepcopy.js)
153+
- Immutable.js
154+
- [为什么用 Immutable.js 代替普通 js 对象?](https://zhuanlan.zhihu.com/p/29983598)
155+
- [facebook immutable.js 意义何在,使用场景?](https://www.zhihu.com/question/28016223)
156+
- [为什么需要 Immutable.js](http://zhenhua-lee.github.io/react/Immutable.html)
157+
158+
```javascript
159+
JSON.parse(JSON.stringify(obj)) // hack
160+
// Issues with Date() when using JSON.stringify() and JSON.parse()
161+
// https://stackoverflow.com/questions/11491938/issues-with-date-when-using-json-stringify-and-json-parse/
162+
```
163+
164+
- 防抖`debounce`: 事件被触发后 N 秒内不能重复执行。如果执行,则 N 重新计时
165+
- 节流`throttle`: 如果持续触发一个事件,则在一定的时间内只执行一次事件
166+
167+
#### 扩展阅读
168+
169+
- [Future JavaScript: what is still missing?](https://2ality.com/2019/01/future-js.html)
170+
- [距离最好的编程语言,JavaScript 还缺些什么?](https://www.infoq.cn/article/Sv8He1JZNj_qZgOxL7zg)
171+
- [ECMAScript 2019: the final feature set](https://2ality.com/2018/02/ecmascript-2019.html)
172+
- [What's New in ES2019: Array flat and flatMap, Object.fromEntries](http://thecodebarbarian.com/whats-new-in-es2019-flat-flatmap-catch.html)
173+
174+
### Redis
175+
176+
#### 知识点
177+
178+
- [Redis 基础](https://juejin.im/post/5db66ed9e51d452a2f15d833)
179+
- [Redis 常见面试题(带答案)](https://juejin.im/post/5dcaebea518825571f5c4ab0)
180+
- [Redis 避免缓存穿透的利器之 BloomFilter](https://juejin.im/post/5db69365518825645656c0de)
181+
182+
#### 其他
183+
184+
- [谈谈 Redis 的 SETNX](https://www.jianshu.com/p/8b3130229515)
185+
- [Redis 的 KEYS 命令引起 RDS 数据库雪崩,RDS 发生两次宕机,造成几百万的资金损失](https://mp.weixin.qq.com/s/SGOyGGfA6GOzxwD5S91hLw)
186+
- [Redis 和 Memcache 的区别总结](https://www.cnblogs.com/aspirant/p/8883871.html)
187+
188+
### 计算机
189+
190+
- [简单介绍 CPU 的工作原理](https://www.cnblogs.com/onepixel/p/8724526.html)
191+
192+
### 计算机网络
193+
194+
> http 数据分隔 CLRF(\r\n)
195+
196+
- [扒一扒 HTTP 的构成](http://mrpeak.cn/blog/http-constitution/)
197+
- [从输入 URL 到页面加载完成的过程中都发生了什么事情?](http://fex.baidu.com/blog/2014/05/what-happen/)
198+
199+
#### TCP/UDP
200+
201+
TCP/UDP/IP
202+
203+
- [**TCP/IP 协议知识科普**](https://www.cnblogs.com/xuanku/p/tcpip.html)
204+
- [深入浅出 TCP/IP 协议栈](https://www.cnblogs.com/onepixel/p/7092302.html)
205+
- [**面试官,不要再问我三次握手和四次挥手**](https://juejin.im/post/5d9c284b518825095879e7a5)
206+
- [通俗大白话来理解 TCP 协议的三次握手和四次分手](https://github.com/jawil/blog/issues/14)
207+
- [TCP 的那些事儿(上)](https://coolshell.cn/articles/11564.html)
208+
209+
- [TCP/IP、Http、Socket 的区别](https://mp.weixin.qq.com/s?__biz=MjM5OTMxMzA4NQ==&mid=403550414&idx=2&sn=b466e4a4a469782a1374095be4bd3036&scene=0#wechat_redirect)
210+
- [如何通俗地解释一下 TCP/UDP 协议和 HTTP、FTP、SMTP 等协议之间的区别?](https://www.zhihu.com/question/20583641)
211+
212+
调优
213+
214+
- [Linux 下 Http 高并发参数优化之 TCP/IP 基础](https://kiswo.com/article/1016)
215+
- [理解 TIME_WAIT](http://www.firefoxbug.com/index.php/archives/2795/)
216+
- [Linux 下 Http 高并发参数优化之 TCP 参数](https://kiswo.com/article/1017)
217+
- [Linux TCP/IP 协议栈调优](https://colobu.com/2014/09/18/linux-tcpip-tuning/)
218+
219+
- [不要在 Linux 上启用 net.ipv4.tcp_tw_recycle 参数](http://www.cnxct.com/coping-with-the-tcp-time_wait-state-on-busy-linux-servers-in-chinese-and-dont-enable-tcp_tw_recycle/)
220+
- [tcp_tw_reuse、tcp_tw_recycle 使用场景及注意事项](https://www.cnblogs.com/lulu/p/4149312.html)
221+
222+
TCP 连接和挥手过程:
223+
224+
![tcp 连接和挥手过程](https://images.cnblogs.com/cnblogs_com/xuanku/688508/o_tcp_status.png)
225+
226+
`TIME_WAIT`是主动关闭方在收到被动关闭方发的`FIN`包之后处于的状态, 这个包是主动关闭方收到的最后一个包了, 在收到这个包之后还不能直接就把连接给关闭了, 还得等待一段时间才能关闭, 等待时间为`2MSL`
227+
228+
为什么要等待一段时间呢? 主要是两个原因:
229+
230+
1. 在收到最后一个包之后主动关闭方还得发一个`ACK`回去, 这个`ACK`可能会丢包, 如果丢包, 对方还需要重新发最后一个`FIN`包, 如果收到重新发过来的`FIN`包的时候这边连接已经关闭, 则会导致连接异常终止;
231+
2. 不过第 1 点也不会造成太大的问题, 毕竟数据已经正常交互了。但是有另外一点风险更高, 就是如果不等待`2MSL`的话, 那么如果正好一个新连接又建立在相同的端口上, 那么上次的`FIN`包可能因为网络原因而延时的包,这个时候才送达该端口, 导致下一次连接出现问题;
232+
233+
所以一定要有一个`TIME_WAIT`的状态等待一段时间, 等待的`MSL`时间`RFC`上面建议是 2 分钟
234+
235+
但是如果你的服务是一个高并发短连接服务, `TIME_WAIT`可能会导致连接句柄被大量占用, 而你又相信服务内部是一个非常稳定的网络服务, 或者即使有两个连接交互出现故障也可以接受或者有应用层处理, 不希望有那么多的`TIME_WAIT`状态的连接, 一般有两种方式:
236+
237+
1. 在建立连接的时候使用`SO_REUSEADDR`选项
238+
2.`/etc/sysctl.conf`中加入如下内容:
239+
240+
```bash
241+
# 表示开启 TCP 连接中 TIME-WAIT sockets 的快速回收,默认为 0,表示关闭
242+
net.ipv4.tcp_tw_recycle = 1
243+
# 表示开启重用。允许将 TIME-WAIT sockets 重新用于新的 TCP 连接,默认为 0,表示关闭
244+
net.ipv4.tcp_tw_reuse = 1
245+
# 对于本端断开的 socket 连接,TCP 保持在 FIN-WAIT-2 状态的时间。对方可能会断开连接或一直不结束连接或不可预料的进程死亡。默认值为 60 秒
246+
# 即 MSL。断开连接四次挥手时,最后会等待 2MSL 后释放文件句柄
247+
net.ipv4.tcp_fin_timeout = 1
248+
# 在每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包的最大数目
249+
net.core.netdev_max_backlog = 4000
250+
```
251+
252+
然后执行`/sbin/sysctl -p`生效参数
253+
254+
#### 扩展阅读
255+
256+
- [高性能网络编程(一):单台服务器并发 TCP 连接数到底可以有多少](http://www.52im.net/thread-561-1-1.html)
257+
- [为什么 QQ 用的是 UDP 协议而不是 TCP 协议?](http://www.52im.net/thread-279-1-1.html)
258+
- [移动端 IM/推送系统的协议选型:UDP 还是 TCP?](http://www.52im.net/thread-33-1-1.html)
259+
- [高性能网络编程(二):上一个10年,著名的 C10K 并发连接问题](http://www.52im.net/thread-566-1-1.html)
260+
- [聊聊 C10K 问题及解决方案](https://my.oschina.net/xianggao/blog/664275)
261+
- [程序员怎么会不知道 C10K 问题呢?](https://medium.com/@chijianqiang/%E7%A8%8B%E5%BA%8F%E5%91%98%E6%80%8E%E4%B9%88%E4%BC%9A%E4%B8%8D%E7%9F%A5%E9%81%93-c10k-%E9%97%AE%E9%A2%98%E5%91%A2-d024cb7880f3)
262+
- [2000 年问题(千年虫问题)](https://zh.wikipedia.org/wiki/2000%E5%B9%B4%E9%97%AE%E9%A2%98)
263+
- [高性能网络编程(三):下一个 10 年,是时候考虑 C10M 并发问题了](http://www.52im.net/thread-568-1-1.html)
264+
- [高性能网络编程(四):从 C10K 到 C10M 高性能网络应用的理论探索](http://www.52im.net/thread-578-1-1.html)
265+
- [高性能网络编程(五):一文读懂高性能网络编程中的 I/O 模型](http://www.52im.net/thread-1935-1-1.html)
266+
- [高性能网络编程(六):一文读懂高性能网络编程中的线程模型](http://www.52im.net/thread-1939-1-1.html)
267+
- [高性能网络编程经典:《The C10K problem(英文)》[附件下载]](http://www.52im.net/thread-560-1-1.html)
268+
269+
#### HTTPS
270+
271+
- [HTTPS 基本过程](https://hit-alibaba.github.io/interview/basic/network/HTTPS.html)
272+
- [**HTTPS 科普扫盲帖**](https://www.cnblogs.com/chyingp/p/https-introduction.html)
273+
274+
#### SSH
275+
276+
- [图解 SSH 原理](https://www.jianshu.com/p/33461b619d53)
277+
278+
#### DNS/CDN
279+
280+
- [CDN 原理简析](https://juejin.im/post/5d105e1af265da1b71530095)
281+
282+
#### 网络攻击
283+
284+
### 算法和数据结构
285+
286+
#### 算法
287+
288+
- [Javascript Array.sort implementation?](https://stackoverflow.com/questions/234683/javascript-array-sort-implementation)
289+
- [js 中 sort 函数的底层实现机制?](https://segmentfault.com/q/1010000007133473)
290+
- [十大经典排序算法(动图演示)](https://www.cnblogs.com/onepixel/p/7674659.html)
291+
- [一致性 hash 算法释义](https://www.cnblogs.com/haippy/archive/2011/12/10/2282943.html)
292+
293+
#### 难点
294+
295+
- [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/)
296+
- [Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/submissions/)
297+
298+
#### 数据结构
299+
300+
- [《吊打面试官》系列 - HashMap](https://juejin.im/post/5dee6f54f265da33ba5a79c8)
301+
302+
### 架构
303+
304+
#### 消息队列
305+
306+
- [消息队列基础](https://juejin.im/post/5dd3ff85e51d453fe34dfcc5)
307+
- [分布式事务、重复消费、顺序消费](https://juejin.im/post/5dda9e7e6fb9a07aae2a3778)
308+
309+
#### 微服务
310+
311+
- [微服务杂谈](https://www.rowkey.me/blog/2019/05/30/msa/)
312+
- [微服务十二要素](https://12factor.net/zh_cn/codebase)
313+
314+
### 运维
315+
316+
- [Learn Enough Command Line to Be Dangerous](https://www.learnenough.com/command-line-tutorial/basics)
317+
- [70个经典的 Shell 脚本面试问题](http://www.imooc.com/article/1131)
318+
319+
### 其他
320+
321+
- [系统设计入门](https://github.com/donnemartin/system-design-primer/blob/master/README-zh-Hans.md)
322+
- [秒杀系统设计与实现](https://github.com/qiurunze123/miaosha)
323+
- [码农翻身全年文章精华](https://mp.weixin.qq.com/s?__biz=MzAxOTc0NzExNg==&mid=2665513504&idx=1&sn=25dd6420e3056101dd3f6fdaedacaa2a&chksm=80d67a63b7a1f37572a5159ff6f53810467c15c8beec94770e8360c45f45036360d77755ee78&scene=21#wechat_redirect)
324+
- [这些知识决定了程序员的上限](https://www.rowkey.me/blog/2019/04/22/upforprogrammer/)
325+
326+
327+
```javascript
328+
console.log(a)
329+
a() // 1
330+
function a() { console.log('1') }
331+
var a = function() { console.log('2' )}
332+
console.log(a)
333+
```
334+
335+
React 虚拟 DOM
336+
337+
```javascript
338+
class Test {
339+
constructor() {
340+
this.echo = () => {
341+
console.log('echo in constructor')
342+
}
343+
}
344+
345+
echo() {
346+
console.log('echo')
347+
}
348+
}
349+
350+
Test.echo // error
351+
new Test().echo() // echo in constructor
352+
```

Notes/NodeJS/Node.js-at-Scale/【译】【Node.js at Scale】理解 Node.js 中的事件循环.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ promise6
308308

309309
**周期1:**
310310

311-
1. `setInterval` 被规划为一个任务
312-
2. `setTimeout 1` 被规划为一个任务
311+
1. `setInterval` 被规划为一个宏任务
312+
2. `setTimeout 1` 被规划为一个宏任务
313313
3. `Promise.resolve 1` 里的 `then` 方法被规划为一个微任务
314314
4. 堆栈空了以后微任务开始执行
315315

0 commit comments

Comments
 (0)