Performance of h5

I send a request using ajax, for example, I use a get request to request https://www.baidu.com/, and then I want to use the performance of h5 to get the timing,. When do I need to get the timing? Is the method to get timing written in the callback?

Mar.23,2021

performace is written on the window object automatically by the browser

so you only need to call window.performace.getEntries (), when the page is loaded, and you can get an array of all requests, and then find your baidu request object. Use the following method to get the time of the request

// 
function getEntryTiming (entry) {  
    var t = entry;
    var times = {};
 
    // 
    times.redirect = t.redirectEnd - t.redirectStart;
 
    // DNS 
    times.lookupDomain = t.domainLookupEnd - t.domainLookupStart;
 
    // 
    times.request = t.responseEnd - t.requestStart;
 
    // TCP 
    times.connect = t.connectEnd - t.connectStart;
 
    //  entry 
    times.name = entry.name;
    times.entryType = entry.entryType;
    times.initiatorType = entry.initiatorType;
    times.duration = entry.duration;
 
    return times;
}

look at http://www.alloyteam.com/2015.


get his series of parameters in the callback of success or failure

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3af1b-2c248.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3af1b-2c248.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?