1 | "use strict";exports.__esModule=true;exports.closePing=closePing;exports.setupPing=setupPing;exports.currentPage=void 0;var _eventsource=require("./error-overlay/eventsource");let evtSource;let currentPage;exports.currentPage=currentPage;function closePing(){if(evtSource)evtSource.close();evtSource=null;}function setupPing(assetPrefix,pathnameFn,retry){const pathname=pathnameFn();
|
2 | if(pathname===currentPage&&!retry)return;exports.currentPage=currentPage=pathname;
|
3 | closePing();evtSource=(0,_eventsource.getEventSourceWrapper)({path:`${assetPrefix}/_next/webpack-hmr?page=${currentPage}`,timeout:5000});evtSource.addMessageListener(event=>{if(event.data.indexOf('{')===-1)return;try{const payload=JSON.parse(event.data);if(payload.invalid){
|
4 |
|
5 | fetch(location.href,{credentials:'same-origin'}).then(pageRes=>{if(pageRes.status===200){location.reload();}});}}catch(err){console.error('on-demand-entries failed to parse response',err);}});}
|
6 |
|
\ | No newline at end of file |