src/performance-timing.js
function getPerformanceTimingData() {
        var PerformanceObj = {
            'redirecting': performance.timing.fetchStart - performance.timing.navigationStart,
            'dnsconnect': performance.timing.requestStart - performance.timing.fetchStart,
            'request': performance.timing.responseStart - performance.timing.requestStart,
            'response': performance.timing.responseEnd - performance.timing.responseStart,
            'domprocessing': performance.timing.domComplete - performance.timing.responseEnd,
            'load': performance.timing.loadEventEnd - performance.timing.loadEventStart
        };

        /**
         * Obtaining the transferred kb of resources inluding estimated document size.
         */
        if (window.performance && window.performance.getEntriesByType) {
            var resource;
            var resources = window.performance.getEntriesByType('resource');
            var documentSize = unescape(encodeURIComponent(document.documentElement.innerHTML)).length / 4.2;
            var byteTotal = 0;
            for (var i = 0; i < resources.length; i++) {
                resource = resources[i];
                byteTotal = byteTotal + resource.transferSize;
            }
            PerformanceObj.transferbytes = byteTotal + Math.round(documentSize);
            PerformanceObj.transferrequests = resources.length + 1;
        }

        return PerformanceObj;
    }
function getPerformanceTimingData() {
        var PerformanceObj = {
            'redirecting': performance.timing.fetchStart - performance.timing.navigationStart,
            'dnsconnect': performance.timing.requestStart - performance.timing.fetchStart,
            'request': performance.timing.responseStart - performance.timing.requestStart,
            'response': performance.timing.responseEnd - performance.timing.responseStart,
            'domprocessing': performance.timing.domComplete - performance.timing.responseEnd,
            'load': performance.timing.loadEventEnd - performance.timing.loadEventStart
        };

        /**
         * Obtaining the transferred kb of resources inluding estimated document size.
         */
        if (window.performance && window.performance.getEntriesByType) {
            var resource;
            var resources = window.performance.getEntriesByType('resource');
            var documentSize = unescape(encodeURIComponent(document.documentElement.innerHTML)).length / 4.2;
            var byteTotal = 0;
            for (var i = 0; i < resources.length; i++) {
                resource = resources[i];
                byteTotal = byteTotal + resource.transferSize;
            }
            PerformanceObj.transferbytes = byteTotal + Math.round(documentSize);
            PerformanceObj.transferrequests = resources.length + 1;
        }

        return PerformanceObj;
    }
function getPerformanceTimingData ( ) { var PerformanceObj = { 'redirecting' : performance . timing . fetchStart - performance . timing . navigationStart , 'dnsconnect' : performance . timing . requestStart - performance . timing . fetchStart , 'request' : performance . timing . responseStart - performance . timing . requestStart , 'response' : performance . timing . responseEnd - performance . timing . responseStart , 'domprocessing' : performance . timing . domComplete - performance . timing . responseEnd , 'load' : performance . timing . loadEventEnd - performance . timing . loadEventStart } ; /**
         * Obtaining the transferred kb of resources inluding estimated document size.
         */ if ( window . performance && window . performance . getEntriesByType ) { var resource ; var resources = window . performance . getEntriesByType ( 'resource' ) ; var documentSize = unescape ( encodeURIComponent ( document . documentElement . innerHTML ) ) . length / 4.2 ; var byteTotal = 0 ; for ( var i = 0 ; i < resources . length ; i ++ ) { resource = resources [ i ] ; byteTotal = byteTotal + resource . transferSize ; } PerformanceObj . transferbytes = byteTotal + Math . round ( documentSize ) ; PerformanceObj . transferrequests = resources . length + 1 ; } return PerformanceObj ; }
Calculating steps in the page loading pipeline.
@return {Object} PerformanceObj containg performance metrics
Calculating steps in the page loading pipeline .