Working with IE11

This commit is contained in:
Sebastian Seedorf
2020-11-15 00:45:41 +01:00
parent b56d0f0676
commit da4cda2507
4 changed files with 19 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ import indexRouter from './routes';
import {HttpLogger, Redis, Config, setupAuthProxy, getReloadRouter, polyfillRoute} from './utils';
import {Store} from 'express-session';
export const app = express();
// view engine setup
@@ -29,7 +28,7 @@ app.use(express.json());
app.use(express.urlencoded({extended: false}));
// compression
app.use(compression);
app.use(compression());
// auth proxy middleware
router.use(setupAuthProxy);

View File

@@ -26,18 +26,24 @@ export function getReloadRouter(): Router {
res.send(`
const loc = window.location;
const url = loc.protocol+'//'+loc.host+'${urlJoin(req.baseUrl, "/auto-reload")}';
const parse = async res => (await res.json()).uuid;
// const parse = async res => (await res.json()).uuid;
const parse = function(res) {
return res.json()
.then(function(json) {return json.uuid;}) }
let hash = undefined;
let hadError = false;
setInterval(async () => {
setInterval(function() {
try {
const data = await parse(await fetch(url));
if (data) {
hash = hash === undefined ? data : hash;
if (hash !== data) {
window.location.reload();
}
}
fetch(url)
.then(function(res) { return parse(res) })
.then(function(data) {
if (data) {
hash = hash === undefined ? data : hash;
if (hash !== data) {
window.location.reload();
}
}
});
} catch (e) {
if (hadError === false) {
console.log(e);

View File

@@ -16,6 +16,7 @@ const features = new WaitForSync<PolyfillFeatureList>();
return feats;
})()
.then(feats => {
feats["fetch"] = {};
Logger.debug("Polyfill analysed:", Object.keys(feats));
features.setData(feats);
})

View File

@@ -4,8 +4,6 @@ html
head
title= title
link(rel='stylesheet', href=baseUrl+'/styles/style.css')
if !Config.isProduction
script(type='text/javascript', async, src=baseUrl+'/auto-reload/client.js')
body
block content
script(type='text/javascript', src=baseUrl+'/js/polyfill.js')
@@ -15,3 +13,5 @@ html
require(['src/index'], function (index) {
index.setConfig({EXTERNAL_BASE_URL: '#{baseUrl}'});
});
if !Config.isProduction
script(type='text/javascript', src=baseUrl+'/auto-reload/client.js')