Skip to content

Commit

Permalink
Merge pull request #29 from Spomky-Labs/features/version-1.3-support
Browse files Browse the repository at this point in the history
Improvement
  • Loading branch information
Spomky authored Nov 21, 2024
2 parents 99db8a8 + 943cef0 commit 499771b
Show file tree
Hide file tree
Showing 29 changed files with 6,011 additions and 1,253 deletions.
3,992 changes: 3,992 additions & 0 deletions .castor.stub.php

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
/assets/vendor/
###< symfony/asset-mapper ###

/public/favicon.ico
/public/favicons
/public/workbox
/public/site.webmanifest
/public/site.*.webmanifest
/public/pwa
/public/favicon.ico
/public/sw.js

###> liip/imagine-bundle ###
/public/media/cache/
###< liip/imagine-bundle ###
52 changes: 46 additions & 6 deletions assets/controllers.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
{
"controllers": {
"@spomky-labs/pwa-bundle": {
"backgroundsync-form": {
"enabled": true,
"fetch": "eager"
},
"badge": {
"enabled": true,
"fetch": "eager"
},
"battery": {
"enabled": true,
"fetch": "eager"
},
"connection-status": {
"enabled": true,
"fetch": "lazy"
"fetch": "eager"
},
"backgroundsync-form": {
"device-orientation": {
"enabled": true,
"fetch": "lazy"
"fetch": "eager"
},
"sync-broadcast": {
"fullscreen": {
"enabled": true,
"fetch": "eager"
},
"geolocation": {
"enabled": true,
"fetch": "eager"
},
"install": {
"enabled": true,
"fetch": "lazy"
"fetch": "eager"
},
"prefetch-on-demand": {
"enabled": true,
"fetch": "lazy"
"fetch": "eager"
},
"presentation": {
"enabled": true,
"fetch": "eager"
},
"receiver": {
"enabled": true,
"fetch": "eager"
},
"share": {
"enabled": true,
"fetch": "eager"
},
"sync-broadcast": {
"enabled": true,
"fetch": "eager"
},
"vibration": {
"enabled": true,
"fetch": "eager"
}
}
},
Expand Down
13 changes: 0 additions & 13 deletions assets/controllers/items_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,12 @@ export default class extends Controller {
// this endpoint will return CORS error
const response = await fetch(this.collectionUrlValue);
if (!response.ok) {
throw new Error("Network response was not OK");
this.errorTarget.innerHTML = 'unable to fetch items at this time.';
console.error('Failed');
return;
} else {
// promise resolved.
const items = await response.json();
const count = items['hydra:totalItems'];
this.messageTarget.innerHTML = `${count} total items`;

this.listTarget.innerHTML = '<ol>'
for (const item of items['hydra:member']) {
// this.listTarget.innerHTML += `<li>${item.name}</li>`;
console.log(item);
}
this.listTarget.innerHTML += `</ol>`;

console.log(items);

}
} catch {
this.messageTarget.innerHTML = 'unable to fetch items at this time.';
Expand Down
15 changes: 0 additions & 15 deletions assets/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,3 @@
You can define here custom rules depending on your application needs.
*/
console.log('Service Worker Loaded...');

addEventListener("backgroundfetchsuccess", (event) => {
const registration = event.registration;
event.waitUntil(async () => {
const cache = await caches.open("movies");
const records = await registration.matchAll();
const cachePromises = records.map(async (record) => {
const response = await record.responseReady;
await cache.put(record.request, response);
});

await Promise.all(cachePromises);
event.updateUI({ title: "Move download complete" });
});
});
Loading

0 comments on commit 499771b

Please sign in to comment.