diff --git a/package.json b/package.json index 0fb36f9..871b219 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "mini-css-extract-plugin": "^0.4.2", "vue2-leaflet": "^1.0.2", "vuex": "^3.0.1", - "vuex-class": "^0.3.1" + "vuex-class": "^0.3.1", + "workbox-webpack-plugin": "^4.3.1" } } diff --git a/resources/ts/app.ts b/resources/ts/app.ts index 0f157a4..3da1fce 100644 --- a/resources/ts/app.ts +++ b/resources/ts/app.ts @@ -35,4 +35,10 @@ Vue.use(Vuex); store.dispatch('messages/update'); store.dispatch('load', window['czydojade'].state); + + if ('serviceWorker' in navigator) { + window.addEventListener('load', function() { + navigator.serviceWorker.register('/dist/service-worker.js'); + }); + } })(); diff --git a/templates/base.html.twig b/templates/base.html.twig index a38c413..dd73ed0 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,7 +3,7 @@
- + @@ -50,6 +50,6 @@ {% block javascripts %}{% endblock %} - +