Unverified Commit 00c00f2f authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

add global callback for refresh latency (#25944)

Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent a008d01c
......@@ -179,7 +179,11 @@ function onFastRefresh(hasUpdates) {
DevOverlay.onRefresh()
}
console.log('[Fast Refresh] done')
const latency = Date.now() - startLatency
console.log(`[Fast Refresh] done in ${latency}ms`)
if (self.__NEXT_HMR_LATENCY_CB) {
self.__NEXT_HMR_LATENCY_CB(latency)
}
}
// There is a newer version of the code available.
......@@ -188,11 +192,14 @@ function handleAvailableHash(hash) {
mostRecentCompilationHash = hash
}
let startLatency = undefined
// Handle messages from the server.
function processMessage(e) {
const obj = JSON.parse(e.data)
switch (obj.action) {
case 'building': {
startLatency = Date.now()
console.log('[Fast Refresh] rebuilding')
break
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment