master
Wilco Kruijer 4 years ago
parent b43a18d566
commit bb9f9892c3
  1. 15
      backend/index.mjs
  2. 20
      backend/package.json
  3. 0
      frontend/.gitignore
  4. 0
      frontend/README.md
  5. 1202
      frontend/package-lock.json
  6. 8
      frontend/package.json
  7. 0
      frontend/public/favicon.ico
  8. 4
      frontend/public/index.html
  9. 0
      frontend/public/logo192.png
  10. 0
      frontend/public/logo512.png
  11. 0
      frontend/public/manifest.json
  12. 0
      frontend/public/robots.txt
  13. 0
      frontend/src/App.css
  14. 77
      frontend/src/App.tsx
  15. BIN
      frontend/src/SourceSansPro.otf
  16. 58
      frontend/src/index.css
  17. 22
      frontend/src/index.tsx
  18. 0
      frontend/src/react-app-env.d.ts
  19. 9
      frontend/src/util/WebWorkerHelper.ts
  20. 9
      frontend/src/util/tsconfig.json
  21. 52
      frontend/src/via-logo.svg
  22. 10
      frontend/src/worker/WebWorker.ts
  23. 0
      frontend/tsconfig.json
  24. 9
      src/App.test.tsx
  25. 26
      src/App.tsx
  26. 13
      src/index.css
  27. 12
      src/index.tsx
  28. 7
      src/logo.svg
  29. 145
      src/serviceWorker.ts
  30. 5
      src/setupTests.ts

@ -0,0 +1,15 @@
import express from "express";
import socketIO from "socket.io";
const PORT = 3001;
const app = express();
app.get('/', (req, res) => res.send('Hello World!'));
const server = app.listen(PORT, () => console.log(`Example app listening on port ${PORT}!`));
const io = socketIO(server);
io.on('connection', socket => {
console.log('a user connected');
});

@ -0,0 +1,20 @@
{
"name": "centurion-via-backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"express": "^4.17.1",
"socket.io": "^2.3.0"
},
"devDependencies": {
"@types/express": "^4.17.2",
"@types/socket.io": "^2.1.4"
}
}

File diff suppressed because it is too large Load Diff

@ -10,9 +10,13 @@
"@types/node": "^12.12.27",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"antd": "^3.26.9",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-radial-progress-indicator": "^1.4.1",
"react-scripts": "3.3.1",
"socket.io-client": "^2.3.0",
"sscaffold-css": "^0.1.0",
"typescript": "^3.7.5"
},
"scripts": {
@ -35,5 +39,9 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/socket.io-client": "^1.4.32",
"eslint-plugin-react-hooks": "^2.3.0"
}
}

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -10,10 +10,6 @@
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

@ -0,0 +1,77 @@
import React, {useEffect} from 'react';
import './App.css';
import logo from "./via-logo.svg"
import {Col, Progress, Row} from "antd"
import io from 'socket.io-client';
const App = () => {
const feedItems = [
{title: "Ha1", body: "Doei", key: 1},
// {title: "Ha2", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
// {title: "Ha3", body: "Doei"},
];
// useEffect(() => {
// socket.on("SENDING_NEW_TIME", data => {
// setTime(data);
// });
// return () => {
// socket.off("SENDING_NEW_TIME");
// };
// }, []);
return (
<div className="app">
<section className="content">
<Row>
<Col className="sider" span={4}>
<h1>Tijd tot volgende shot:</h1>
<Progress type="circle"
percent={75}
strokeColor={"#304ba3"}
strokeWidth={10}/>
</Col>
<Col className="feed" span={16}>
{feedItems.map(o =>
<Row key={o.key} className="feed-item">
<Col span={4}>Tijd</Col>
<Col span={3} offset={5}>{o.title}</Col>
<Col span={3}>Icoon</Col>
<Col span={3}>{o.body}</Col>
</Row>
)}
</Col>
<Col className="sider" span={4}>
<h1>Shots genomen:</h1>
<Progress type="circle"
percent={25}
strokeColor={"#304ba3"}
strokeWidth={10}/>
</Col>
</Row>
</section>
<footer>
<img src={logo} className="via-logo" alt="logo"/>
</footer>
</div>
);
};
export default App;

Binary file not shown.

@ -0,0 +1,58 @@
@import '~antd/dist/antd.css';
@font-face {
font-family: 'SourceSansPro';
src: local('SourceSansPro'), url(./SourceSansPro.otf) format('opentype');
}
:root {
--footer-height: 4.5em;
--content-height: calc(100vh - var(--footer-height));
}
body {
background-color: #e5e5e5;
}
.app {
font-family: 'SourceSansPro', sans-serif;
}
.feed {
max-height: var(--content-height);
overflow: hidden;
padding: 0.5em;
}
.feed-item {
background-color: whitesmoke;
padding: 0.5em;
margin-bottom: 1em;
min-height: 5em;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
border-radius: 2px;
}
.content {
padding: 1rem;
height: var(--content-height)
}
.via-logo {
width: auto;
height: 4em;
}
.sider {
text-align: center;
}
h1 {
min-height: 3em;
}
footer {
border-top: 1px solid lightgray;
padding: 0.25em 0.5em;
height: 4.5em;
}

@ -0,0 +1,22 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import WebWorkerHelper from "./util/WebWorkerHelper";
import WebWorker from "./worker/WebWorker";
// web worker ?
// https://stackoverflow.com/questions/47475360/creating-a-web-worker-inside-react
const worker: Worker = new WebWorkerHelper(WebWorker) as Worker;
worker.addEventListener("message", e => {
console.log("Received response:");
console.log(e.data);
}, false);
worker.postMessage("bar");
console.log(worker);
ReactDOM.render(<App/>, document.getElementById('root'));

@ -0,0 +1,9 @@
export default class WebWorkerHelper {
constructor(worker: any) {
let code = worker.toString();
code = code.substring(code.indexOf("{") + 1, code.lastIndexOf("}"));
const blob = new Blob([code], { type: "application/javascript" });
return new Worker(URL.createObjectURL(blob));
}
}

@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es2015",
"lib": [
"es2015",
"webworker"
]
}
}

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Laag_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="75 111 443 176" xml:space="preserve">
<style type="text/css">
.st0{fill:#2E4C9C;}
</style>
<circle class="st0" cx="394.5" cy="126.7" r="14.9"/>
<path class="st0" d="M457.7,152.3c-8.5,0.3-16.5,1.9-23.3,4.4c-2.2,0.8-4.4,1.9-4.4,2s1.3,4.5,2.8,9.9s2.8,9.9,2.8,9.9
s0.6-0.2,1.2-0.5c5.3-2.4,11.5-3.7,18.8-4.1c2.2-0.1,7.9-0.1,9.3,0.1c3.7,0.4,6.2,1,8.9,2.1c6.7,2.7,10.4,8.1,10.7,15.8
c0.1,1.5,0,1.5-0.1,1.5c-1.6-0.5-5.6-1.2-8.1-1.4c-3-0.3-10.2,0-15.1,0.6c-14.2,1.7-24.9,6.2-32.4,13.7c-5.8,5.8-9.1,12.6-10.1,21.4
c-0.2,1.8-0.3,6.8-0.1,8.7c0.4,5.2,1.5,9.5,3.6,13.4c2.8,5.4,7.1,9.7,12.8,12.7c6.2,3.2,14,4.8,22.7,4.6c5-0.1,9.3-0.8,13.8-2.3
c7.2-2.4,12.4-5.8,15.2-10c0.3-0.4,0.5-0.7,0.5-0.7s0.2,0.4,0.4,0.9c1,2.6,2.8,5.2,5.2,7.5c2.4,2.3,4.8,3.7,7.5,4.3
c1.9,0.4,5.3,0.4,8.1-0.1c2.6-0.4,4.6-1.1,6-2c1.5-1,3.4-3.2,4.6-5.2l0.3-0.5l-0.5-0.3c-4.4-3.2-7.1-9.7-8-19.2
c-0.1-0.9-0.2-1.8-0.2-2c0-0.3-0.1-8.4-0.1-18c-0.1-17.3-0.1-18.6-0.4-23.1c-0.9-12.4-3.7-22.1-8.1-28.5
c-4.7-6.9-12.7-11.7-23.3-13.9C472.6,152.6,465.2,152,457.7,152.3z M478.6,211.8c1.5,0.2,4.6,0.7,5.8,1l0.5,0.1v6.5
c0,5.1-0.1,6.8-0.2,8c-1,8.9-4.9,14.6-11.8,17.3c-1.8,0.7-4.4,1.3-7,1.6c-1.4,0.2-6.8,0.2-8.2,0c-4.2-0.5-7.3-1.8-9.5-3.9
c-1-1-1.6-1.8-2.3-3c-1.1-2.2-1.7-4.7-1.7-7.9c0-4.1,0.9-7.5,2.9-10.4c0.7-1.1,2.3-2.8,3.5-3.7c4.4-3.5,11.1-5.4,20.2-5.9
C473.5,211.5,476.8,211.6,478.6,211.8z"/>
<path class="st0" d="M376.8,154.7c0,0.1-9.6,21.1-9.6,21.1h14v91.4h26.2V154.6C407.3,154.6,376.8,154.6,376.8,154.7z"/>
<path class="st0" d="M254.6,154.9c0.1,0.1,49.8,112.2,49.8,112.2h9.5c0,0,51.1-112.3,51.1-112.4c0,0-27.3-0.1-27.3,0
c-0.3,0.9-28.3,67.3-28.3,67.3l-26.5-67.5h-28.2L254.6,154.9z"/>
<path class="st0" d="M165.8,211.5c-0.7-0.7-0.7-1.9,0-2.7l12-11.9c0.7-0.7,0.7-1.8,0-2.5l-7.4-7.4c-0.7-0.7-1.8-0.7-2.5,0L156,199
c-0.7,0.7-1.9,0.7-2.7,0l-11.9-11.9c-0.7-0.7-1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c-1.6,4.4-1.8,9-2,13.6c-0.2,4.2-0.3,8.5-0.4,12.7
c0,0.8-0.2,1.7-0.5,2.5c-0.8,2.4-2.9,3.3-5.2,3.6c-1.7,0.2-3.4,0.3-5,0.4c-1.1,0.1-1.4,0.4-1.4,1.5c0,3.9,0,7.8,0,11.7
c0,1.1,0.4,1.5,1.5,1.6c4.8,0,9.7,0,14.4-1.4c3.4-1,6.2-2.9,8.4-5.7c2.2-2.9,3.2-6.2,3.4-9.7c0.3-4.4,0.3-8.7,0.5-13.1
c0.1-3.2,0.3-6.5,0.6-9.7c0.2-2.3,1.1-4.5,2.3-6.5c1.2-2.2,3.3-3.2,5.6-3.8c1.5-0.4,3-0.5,4.5-0.8
C233.7,212.9,233.7,208,233.7,203.1z"/>
<path class="st0" d="M165.8,266c-0.7-0.7-0.7-1.9,0-2.7l12-11.9c0.7-0.7,0.7-1.8,0-2.5l-7.4-7.4c-0.7-0.7-1.8-0.7-2.5,0l-11.9,12
c-0.7,0.7-1.9,0.7-2.7,0l-11.9-11.9c-0.7-0.7-1.8-0.7-2.5,0l-7.4,7.4c-0.7,0.7-0.7,1.8,0,2.5l11.9,11.9c0.7,0.7,0.7,1.9,0,2.7
l-11.8,11.8c-0.7,0.7-0.7,1.8,0,2.5l7.4,7.4c0.7,0.7,1.8,0.7,2.5,0l10.4-10.4l0,0l1.4-1.4c0.7-0.7,1.9-0.7,2.7,0l11.9,11.9
c0.7,0.7,1.8,0.7,2.5,0l7.4-7.4c0.7-0.7,0.7-1.8,0-2.5L165.8,266z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

@ -0,0 +1,10 @@
export default function WebWorker() {
// @ts-ignore
const ctx: Worker = this as any;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const onmessage = (e: MessageEvent) => {
console.log("ww got message")
ctx.postMessage("Response");
};
}

@ -1,9 +0,0 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

@ -1,26 +0,0 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
const App = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;

@ -1,13 +0,0 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

@ -1,12 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
<g fill="#61DAFB">
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
<circle cx="420.9" cy="296.5" r="45.7"/>
<path d="M520.5 78.1z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

@ -1,145 +0,0 @@
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
type Config = {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
process.env.PUBLIC_URL,
window.location.href
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
headers: { 'Service-Worker': 'script' }
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';
Loading…
Cancel
Save