code: function() {
        // Try the standardized paint timing api
        try {
          var entries = performance.getEntriesByType('paint');
          for (var i = 0; i < entries.length; i++) {
            if (entries[i]['name'] == 'first-paint') {
              navStart = performance.getEntriesByType("navigation")[0].startTime;
              firstPaint = entries[i].startTime - navStart;
              break;
            }
          }
        } catch(e) {
        }
        // If the browser supports a first paint event, just use what the browser reports
        if (firstPaint === undefined && 'msFirstPaint' in win.performance.timing)
          firstPaint = win.performance.timing.msFirstPaint - navStart;
        // For browsers that don't support first-paint or where we get insane values,
        // use the time of the last non-async script or css from the head.
        if (firstPaint === undefined || firstPaint < 0 || firstPaint > 120000) {
          firstPaint = win.performance.timing.responseStart - navStart;
          var headURLs = {};
          var headElements = doc.getElementsByTagName('head')[0].children;
          for (var i = 0; i < headElements.length; i++) {
            var el = headElements[i];
            if (el.tagName == 'SCRIPT' && el.src && !el.async)
              headURLs[el.src] = true;
            if (el.tagName == 'LINK' && el.rel == 'stylesheet' && el.href)
              headURLs[el.href] = true;
          }
          var requests = win.performance.getEntriesByType("resource");
          var doneCritical = false;
          for (var j = 0; j < requests.length; j++) {
            if (!doneCritical &&
                headURLs[requests[j].name] &&
               (requests[j].initiatorType == 'script' || requests[j].initiatorType == 'link')) {
              var requestEnd = requests[j].responseEnd;
              if (firstPaint === undefined || requestEnd > firstPaint)
                firstPaint = requestEnd;
            } else {
              doneCritical = true;
            }
          }
        }
        firstPaint = Math.max(firstPaint, 0);
      }
docs: Get the first paint time.