我在Chrome DevTools中大量使用了性能时间表来捕获页面的性能记录。
大多数时候,我使用“开始配置和重新加载页面”,它会自动开始和停止记录。
问题是: DevTools何时决定停止记录?
我注意到它总是继续记录“加载”事件之后至少几百毫秒,并试图弄清页面何时变为“大部分空闲”。
但这是一个相当模糊的猜测。我想知道它是否依赖于某些表演事件(例如在Lighthouse中的“互动时间”中使用的那个事件)?
答案 0 :(得分:2)
当前等待three秒after load
event。
该文件没有记录,因此将来可能会更改,恕不另行通知。
this._millisecondsToRecordAfterLoadEvent = 3000;
async _loadEventFired(event) {
if (this._state !== Timeline.TimelinePanel.State.Recording || !this._recordingPageReload ||
this._controller.mainTarget() !== event.data.resourceTreeModel.target())
return;
const controller = this._controller;
await new Promise(r => setTimeout(r, this._millisecondsToRecordAfterLoadEvent));
// Check if we're still in the same recording session.
if (controller !== this._controller || this._state !== Timeline.TimelinePanel.State.Recording)
return;
this._stopRecording();
}