Skip to content

Instantly share code, notes, and snippets.

@zpbx
Created March 21, 2017 09:23
Show Gist options
  • Save zpbx/baddcf19de9892cef236cc1875869fff to your computer and use it in GitHub Desktop.
Save zpbx/baddcf19de9892cef236cc1875869fff to your computer and use it in GitHub Desktop.
在页面中获取两个关键指标
function test(cond) {
'use strict'
let data = {}
data.N0 = performance.timing.navigationStart
data.L0 = performance.timing.loadEventStart
data.P = window.chrome.loadTimes().firstPaintTime * 1000
data.metric1 = data.P - data.N0
data.metric2 = data.L0 - data.N0
console.log(`${cond} | ${data.metric1} | ${data.metric2}`)
}
test('2g')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment