我希望编写一个前端监控实用程序来记录 API 调用的服务器响应时间和内容下载时间。
使用XHR,readyState
3 (LOADING
)表示下载开始。
如何从 fetch()
API 获取类似的信息?
最佳答案
您可以使用PerformanceObserver()
Count console.log objects和 性能
。您还可以利用 EventSource
参见 How to read and echo file size of uploaded file being written at server in real time without blocking at both server and client?
关于javascript - 是否有类似于 fetch() API 中的 readyState 的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46955675/