每过1秒实时检查是否存在对应的值
let load =(cb) =>{ let timer let check = ()=>{ if(performance.timing.loadEventEnd){ clearTimeout(timer) cb() }else{ timer = setTimeout(check,100) } } window.addEventListener('load',check,false) } load(()=>{ let perfData = performance.timing let data = processData(perfData) cb(data) })