Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优秀文章收集整理 #11

Open
yandeqiang opened this issue Feb 24, 2018 · 0 comments
Open

优秀文章收集整理 #11

yandeqiang opened this issue Feb 24, 2018 · 0 comments

Comments

@yandeqiang
Copy link
Owner

yandeqiang commented Feb 24, 2018

整理

之前看过的一些优秀文章/帖子,之后在看过之后,发现忘的差不多了 😂,整理下,之后经常回过头来看看。

js

event loop、 执行顺序相关

  1. 从Promise来看JavaScript中的Event Loop、Tasks和Microtasks
  2. Node 定时器详解
  3. Event Loop的规范和实现

重点:

  • task主要包含:setTimeout、setInterval、setImmediate、I/O、UI交互事件
  • microtask主要包含:Promise、process.nextTick、MutaionObserver
  • 浏览器环境下,执行顺序
    • timer类型的API(setTimeout/setInterval)注册的函数,等到期后进入task队列(这里不详细展开timer的运行机制)
    • 其余API注册函数直接进入自身对应的task/microtask队列
    • Event Loop执行一次,从task队列中拉出一个task执行
    • Event Loop继续检查microtask队列是否为空,依次执行直至清空队列
  • node 环境下:
    • expired timers and intervals,即到期的setTimeout/setInterval(同时到期会被合并)
    • I/O events,包含文件,网络等等
    • immediates,通过setImmediate注册的函数
    • close handlers,close事件的回调,比如TCP连接断开
    • 同步任务及每个阶段之后都会清空microtask队列
      • 优先清空next tick queue,即通过process.nextTick注册的函数
      • 再清空other queue,常见的如Promise

网络请求

  1. 跨域资源共享 CORS 详解

页面监控

  1. 如何精确统计页面停留时长

性能

  1. 从 url 输入到展现页面发生了什么
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant