18
연결 속도를 감지하고 있으므로 지속 시간 계산을 위해 window.performance 개체를 사용할 계획입니다.window.performance javacript 설명
저는 약간의 window.performance.timing 개체가 전체 페이지로드를 기반으로 생성되거나 마지막 요청과 응답을 기반으로 생성됩니다. 예를 들어
: 나는 웹 페이지로드 5 서버 호출을 데
는 performance.timing
객체는 모두 5 서버 호출에 기반 또는 5 서버 호출 (마지막 호출)를 기반으로 생성됩니다. window.performance에 대한
어떤 생각을 설명 할 준비
var bitsLoaded = 100000; //bits total size of all files (5 server call).
var duration = performance.timing.responseEnd - performance.timing.navigationStart;
var speedBps = Math.round(bitsLoaded/duration);
var speedKbps = (speedBps/1024).toFixed(2);
var speedMbps = (speedKbps/1024).toFixed(2);
아무것도 명확하지 참조
샘플 연결 속도 계산