Re: [manifest] How does updating work? (#384)

> Can you unpack that a little, what does it mean? Will an HTTP GET request to the manifest URL always get you the latest manifest?

Independently of the application being run, probably not. An independent process cannot just go looking for a manifest on its own - it needs to do it as part of the the application life-cycle. 

>  If not, what else does the user agent need to do to get the manifest? 

The user needs to open the application. And then the user agent needs to check if there is a manifest. If there is one, download it and apply it.

>How would "background sync" work?

Maybe something like: 

```
navigator.serviceWorker.ready.then(function(registration) {
  registration.periodicSync.register({
    tag: 'get-latest-manfiest',     
    minPeriod: 12 * 60 * 60 * 1000, 
    powerState: 'avoid-draining',  
    networkState: 'avoid-cellular',
  }).then(function(periodicSyncReg) {
    // success
  }, function() {
    // failure
  })
});

// In SW... 
self.addEventListener('periodicsync', function(event) {
  if (event.registration.tag == 'get-latest-manifest') {
    event.waitUntil(fetchAndCacheLatestManifest());
  } 
});

// User opens app... browser checks manifest... oh... it has changed, re-apply! 
```

There is more complexity to the above... like the actual icons might have been updated by are still named the same thing, so it might be a matter of doing a HEAD request to check those, etc.  


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/384#issuecomment-118333552

Received on Friday, 3 July 2015 12:22:16 UTC