I was just wondering if there is a convenient way to cache an entire PWA on click? Just like you would download and install a native app from an app store?
If I am not wrong, the only solution currently is that you have to add all existing files in an array and use the cache.addAll method (as you see below). You can execute the function then if the button was clicked.
function downloadApp() {
caches.open(appCache).then(function(cache) {
return cache.addAll([
'/',
'/files/1',
'/files/2',
// ...
// All PWA files
]);
})
}
Do you know any better approaches for this?