Working with IE11
This commit is contained in:
@@ -10,7 +10,6 @@ import indexRouter from './routes';
|
|||||||
import {HttpLogger, Redis, Config, setupAuthProxy, getReloadRouter, polyfillRoute} from './utils';
|
import {HttpLogger, Redis, Config, setupAuthProxy, getReloadRouter, polyfillRoute} from './utils';
|
||||||
import {Store} from 'express-session';
|
import {Store} from 'express-session';
|
||||||
|
|
||||||
|
|
||||||
export const app = express();
|
export const app = express();
|
||||||
|
|
||||||
// view engine setup
|
// view engine setup
|
||||||
@@ -29,7 +28,7 @@ app.use(express.json());
|
|||||||
app.use(express.urlencoded({extended: false}));
|
app.use(express.urlencoded({extended: false}));
|
||||||
|
|
||||||
// compression
|
// compression
|
||||||
app.use(compression);
|
app.use(compression());
|
||||||
|
|
||||||
// auth proxy middleware
|
// auth proxy middleware
|
||||||
router.use(setupAuthProxy);
|
router.use(setupAuthProxy);
|
||||||
|
|||||||
@@ -26,18 +26,24 @@ export function getReloadRouter(): Router {
|
|||||||
res.send(`
|
res.send(`
|
||||||
const loc = window.location;
|
const loc = window.location;
|
||||||
const url = loc.protocol+'//'+loc.host+'${urlJoin(req.baseUrl, "/auto-reload")}';
|
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 hash = undefined;
|
||||||
let hadError = false;
|
let hadError = false;
|
||||||
setInterval(async () => {
|
setInterval(function() {
|
||||||
try {
|
try {
|
||||||
const data = await parse(await fetch(url));
|
fetch(url)
|
||||||
if (data) {
|
.then(function(res) { return parse(res) })
|
||||||
hash = hash === undefined ? data : hash;
|
.then(function(data) {
|
||||||
if (hash !== data) {
|
if (data) {
|
||||||
window.location.reload();
|
hash = hash === undefined ? data : hash;
|
||||||
}
|
if (hash !== data) {
|
||||||
}
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (hadError === false) {
|
if (hadError === false) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const features = new WaitForSync<PolyfillFeatureList>();
|
|||||||
return feats;
|
return feats;
|
||||||
})()
|
})()
|
||||||
.then(feats => {
|
.then(feats => {
|
||||||
|
feats["fetch"] = {};
|
||||||
Logger.debug("Polyfill analysed:", Object.keys(feats));
|
Logger.debug("Polyfill analysed:", Object.keys(feats));
|
||||||
features.setData(feats);
|
features.setData(feats);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ html
|
|||||||
head
|
head
|
||||||
title= title
|
title= title
|
||||||
link(rel='stylesheet', href=baseUrl+'/styles/style.css')
|
link(rel='stylesheet', href=baseUrl+'/styles/style.css')
|
||||||
if !Config.isProduction
|
|
||||||
script(type='text/javascript', async, src=baseUrl+'/auto-reload/client.js')
|
|
||||||
body
|
body
|
||||||
block content
|
block content
|
||||||
script(type='text/javascript', src=baseUrl+'/js/polyfill.js')
|
script(type='text/javascript', src=baseUrl+'/js/polyfill.js')
|
||||||
@@ -15,3 +13,5 @@ html
|
|||||||
require(['src/index'], function (index) {
|
require(['src/index'], function (index) {
|
||||||
index.setConfig({EXTERNAL_BASE_URL: '#{baseUrl}'});
|
index.setConfig({EXTERNAL_BASE_URL: '#{baseUrl}'});
|
||||||
});
|
});
|
||||||
|
if !Config.isProduction
|
||||||
|
script(type='text/javascript', src=baseUrl+'/auto-reload/client.js')
|
||||||
|
|||||||
Reference in New Issue
Block a user