Commit 26f764eb authored by Michael Ochmann's avatar Michael Ochmann
Browse files

transformed to a pwa

parent e173f76e
{
"name": "HeightTrackr",
"short_name": "HeightTrackr",
"theme_color": "#dd00c0",
"background_color": "#21f362",
"display": "standalone",
"orientation": "portrait",
"Scope": "/",
"start_url": "/src/index.html",
"icons": null,
"splash_pages": null
}
\ No newline at end of file
......@@ -4,9 +4,9 @@
"description": "",
"main": "main.js",
"scripts": {
"build" : "npm install && npm run build:css",
"build:css" : "node-sass --output-style compressed src/scss/app.scss src/app.css",
"watch:css" : "node-sass -w src/scss/app.scss -o src/"
"build": "npm install && npm run build:css",
"build:css": "node-sass --output-style compressed src/scss/app.scss src/app.css",
"watch:css": "node-sass -w src/scss/app.scss -o src/"
},
"repository": {
"type": "git",
......@@ -16,5 +16,8 @@
"license": "MIT",
"devDependencies": {
"node-sass": "^4.9.0"
},
"dependencies": {
"workbox-sw": "^3.2.0"
}
}
......@@ -7,6 +7,7 @@
<meta name=apple-mobile-web-app-status-bar-style content=black-translucent>
<title>HeightTracker</title>
<link rel=stylesheet type=text/css href=app.css>
<link rel=manifest href=../manifest.json>
<script type=module src="javascript/main.js"></script>
</head>
<body>
......
......@@ -5,6 +5,8 @@ import Std from "./Std.js";
class App {
constructor() {
App.RegisterWorker();
if (!navigator.geolocation)
alert("Your browser does not support geo data!");
......@@ -32,6 +34,16 @@ class App {
));
});
}
static RegisterWorker() {
if ("serviceWorker" in navigator) {
try {
navigator.serviceWorker.register("../worker.js");
} catch (error) {
console.log(error);
}
}
}
}
export default App;
\ No newline at end of file
importScripts("./node_modules/workbox-sw/build/workbox-sw.js");
const assets = [
"./",
"./src/javascript/App.js",
"./src/javascript/GeoPoint.js",
"./src/javascript/HeightMap.js",
"./src/javascript/main.js",
"./src/javascript/smallQ.js",
"./src/javascript/Std.js",
"./src/app.css",
"./src/index.html"
];
if (workbox) {
workbox.precaching.precacheAndRoute(assets);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment