Second frontend, written in Next.JS + Typescript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
5.2 KiB

{"ast":null,"code":"\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nexports.__esModule = true;\nexports.closePing = closePing;\nexports.setupPing = setupPing;\nexports.currentPage = void 0;\n\nvar _unfetch = _interopRequireDefault(require(\"next/dist/build/polyfills/unfetch\"));\n\nvar _eventsource = require(\"./error-overlay/eventsource\");\n/* global location */\n\n\nvar evtSource;\nvar currentPage;\nexports.currentPage = currentPage;\n\nfunction closePing() {\n if (evtSource) evtSource.close();\n evtSource = null;\n}\n\nfunction setupPing(assetPrefix, pathnameFn, retry) {\n var pathname = pathnameFn(); // Make sure to only create new EventSource request if page has changed\n\n if (pathname === currentPage && !retry) return;\n exports.currentPage = currentPage = pathname; // close current EventSource connection\n\n closePing();\n var url = assetPrefix + \"/_next/webpack-hmr?page=\" + currentPage;\n evtSource = (0, _eventsource.getEventSourceWrapper)({\n path: url,\n timeout: 5000,\n ondemand: 1\n });\n evtSource.addMessageListener(function (event) {\n if (event.data.indexOf('{') === -1) return;\n\n try {\n var payload = JSON.parse(event.data);\n\n if (payload.invalid) {\n // Payload can be invalid even if the page does not exist.\n // So, we need to make sure it exists before reloading.\n (0, _unfetch[\"default\"])(location.href, {\n credentials: 'same-origin'\n }).then(function (pageRes) {\n if (pageRes.status === 200) {\n location.reload();\n }\n });\n }\n } catch (err) {\n console.error('on-demand-entries failed to parse response', err);\n }\n });\n}","map":{"version":3,"sources":["/home/gisle/projects/react/rpdata-frontend2/node_modules/next/dist/client/dev/on-demand-entries-utils.js"],"names":["_interopRequireDefault","require","exports","__esModule","closePing","setupPing","currentPage","_unfetch","_eventsource","evtSource","close","assetPrefix","pathnameFn","retry","pathname","url","getEventSourceWrapper","path","timeout","ondemand","addMessageListener","event","data","indexOf","payload","JSON","parse","invalid","location","href","credentials","then","pageRes","status","reload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mB,GAAnB,MAA0B,CAAC,CAA9B,EAAgC;;AAAO,QAAG;AAAC,UAAIC,OAAO,GAACC,IAAI,CAACC,KAAL,CAAWL,KAAK,CAACC,IAAjB,CAAZ;;AAAmC,UAAGE,OAAO,CAACG,OAAX,EAAmB;AAAC;AACnS;AACA,SAAC,GAAEpB,QAAQ,WAAX,EAAqBqB,QAAQ,CAACC,IAA9B,EAAmC;AAACC,UAAAA,WAAW,EAAC;AAAb,SAAnC,EAAgEC,IAAhE,CAAqE,UAAAC,OAAO,EAAE;AAAC,cAAGA,OAAO,CAACC,MAAR,KAAiB,GAApB,EAAwB;AAACL,YAAAA,QAAQ,CAACM,MAAT;AAAmB;AAAC,SAA5H;AAA+H;AAAC,KAFwG,CAExG,OAAMC,GAAN,EAAU;AAACC,MAAAA,OAAO,CAACC,KAAR,CAAc,4CAAd,EAA2DF,GAA3D;AAAiE;AAAC,GAFjD;AAEoD","sourcesContent":["\"use strict\";var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");exports.__esModule=true;exports.closePing=closePing;exports.setupPing=setupPing;exports.currentPage=void 0;var _unfetch=_interopRequireDefault(require(\"next/dist/build/polyfills/unfetch\"));var _eventsource=require(\"./error-overlay/eventsource\");/* global location */var evtSource;var currentPage;exports.currentPage=currentPage;function closePing(){if(evtSource)evtSource.close();evtSource=null;}function setupPing(assetPrefix,pathnameFn,retry){var pathname=pathnameFn();// Make sure to only create new EventSource request if page has changed\nif(pathname===currentPage&&!retry)return;exports.currentPage=currentPage=pathname;// close current EventSource connection\nclosePing();var url=assetPrefix+\"/_next/webpack-hmr?page=\"+currentPage;evtSource=(0,_eventsource.getEventSourceWrapper)({path:url,timeout:5000,ondemand:1});evtSource.addMessageListener(event=>{if(event.data.indexOf('{')===-1)return;try{var payload=JSON.parse(event.data);if(payload.invalid){// Payload can be invalid even if the page does not exist.\n// So, we need to make sure it exists before reloading.\n(0,_unfetch.default)(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);}});}"]},"metadata":{},"sourceType":"script"}