Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there something similar to readyState from fetch() API?

I hope to write a front-end monitoring utility to record server response time and content downloading time for API calls.

Using XHR, readyState 3 (LOADING) indicating downloading begins.

How can I get similar information from fetch() API?

like image 318
Yishu Fang Avatar asked Sep 14 '25 06:09

Yishu Fang


1 Answers

You can use PerformanceObserver() Count console.log objects and Performance. You can also utilize EventSource see How to read and echo file size of uploaded file being written at server in real time without blocking at both server and client?

like image 185
guest271314 Avatar answered Sep 16 '25 20:09

guest271314