Browse Source

Merge 99fd654e4b into 8ecaed3d2f

pull/135/merge
jamestthompson3 3 weeks ago
committed by GitHub
parent
commit
bcf72fa141
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 0 deletions
  1. +3
    -0
      public/js/manifest.json
  2. +7
    -0
      public/js/register-sw.js
  3. +14
    -0
      public/js/sw.js
  4. +1
    -0
      views/index.php

+ 3
- 0
public/js/manifest.json View File

@ -2,6 +2,9 @@
"name": "Quill",
"short_name": "Quill",
"description": "Quill is a simple app for posting to your website",
"background_color": "#428bca",
"display": "standalone",
"start_url": "/dashboard",
"icons": [
{
"src": "/images/quill-icon-57.png",

+ 7
- 0
public/js/register-sw.js View File

@ -0,0 +1,7 @@
(function registerSW() {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/js/sw.js").catch((e) => {
console.log("Registration fail: ", e);
});
}
})();

+ 14
- 0
public/js/sw.js View File

@ -0,0 +1,14 @@
// NOTE: This currently doesn't cache anything
// We are just installing it so that chrome users can be
// prompted to install Quill via add to homescreen
self.addEventListener("install", installWorker);
async function installWorker() {
await self.skipWaiting();
}
self.addEventListener("activate", activateServiceWorker);
async function activateServiceWorker(event) {
event.waitUntil(clients.claim()); // make the current sw the active sw in all pages
}

+ 1
- 0
views/index.php View File

@ -32,4 +32,5 @@
<a href="" class="u-url"></a>
</div>
<script src="/js/register-sw.js"></script>
</div>

Loading…
Cancel
Save