var navigationStartTime = window.performance.timing.navigationStart;
function domTimingRecordEvents(){
var domEventObject = {};
var domArray = [];
domEventObject.domLoadingStartTime = (window.performance.timing.domLoading - navigationStartTime)/1000;
domEventObject.domInteractiveTime = (window.performance.timing.domInteractive - navigationStartTime)/1000;
domEventObject.domContentLoadedEventStartTime = (window.performance.timing.domContentLoadedEventStart - navigationStartTime)/1000;
domEventObject.domContentLoadedEventEndTime = (window.performance.timing.domContentLoadedEventEnd - navigationStartTime)/1000;
domEventObject.domCompleteTime = (window.performance.timing.domComplete - navigationStartTime)/1000;
domEventObject.loadEventStartTime = (window.performance.timing.loadEventStart - navigationStartTime)/1000;
//var loadEventEndTime = (window.performance.timing.loadEventEnd - navigationStartTime)/1000;
domArray.push(domEventObject);
console.table(domArray);
}
domTimingRecordEvents();
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
并跳过上面的代码或有其他方法吗?
答案 0 :(得分:1)
Windows性能它是JavaScript中的新功能,并且所有浏览器都不支持所有功能。
请查看Mozilla的此文档,了解为每个浏览器实现的功能
https://developer.mozilla.org/en-US/docs/Web/API/Performance