Skip to content

Commit 1b00dff

Browse files
committed
Screen view fixups
- Use non arrow style JS - Add AbortController polyfill
1 parent 2644810 commit 1b00dff

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

hackman/static/screen/app.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
(() => {
1+
(function() {
22
const timeoutSeconds = 50;
33
const controller = new AbortController();
4-
const timeoutId = setTimeout(() => controller.abort(), timeoutSeconds * 1000);
4+
const timeoutId = setTimeout(function() {
5+
controller.abort();
6+
}, timeoutSeconds * 1000);
57

68
fetch("/screen/poll/")
7-
.then(resp => {
9+
.then(function(resp) {
810
if(!resp.ok) {
911
window.location.href = '/screen/';
1012
return Promise.reject("Response not OK: " + resp.status);
1113
}
1214
return resp.text();
1315
})
14-
.then((url) => {
16+
.then(function(url) {
1517
window.location.href = url;
1618
})
17-
.catch(err => {
18-
window.location.href = '/screen/';
19+
.catch(function(err) {
20+
window.location.href = '/screen/';
1921
})
20-
.then(() => {
22+
.then(function() {
2123
clearTimeout(timeoutId);
2224
})
2325
;
24-
})();
26+
}))();

hackman/templates/screen/base.jinja2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<title>DSL Door 點心樂部門</title>
88
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
99
<link rel="stylesheet" type="text/css" href="/static/screen/style.css">
10+
11+
<!-- Add to home screen -->
12+
<meta name="mobile-web-app-capable" content="yes">
1013
</head>
1114
<body>
1215
<main>
@@ -16,6 +19,7 @@
1619

1720
</main>
1821
</body>
19-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fetch/3.6.2/fetch.min.js"></script>
22+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/fetch.min.js"></script>
23+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd-polyfill.min.js"></script>
2024
<script type="text/javascript" src="/static/screen/app.js"></script>
2125
</html>

0 commit comments

Comments
 (0)