## 2018-04-05 Update OfflineFirst Cache

To implement a proper #OfflineFirst style page loading... we need to know if the contents of the cache is still valid. We could do this in a "E-Tag" like manner on a per file basis, or we could do it all at once. 


```javascript
(async () => {
  
  var offlineFirstCache = await caches.open("offlineFirstCache")
  var url = "https://lively-kernel.org/lively4S2/lively4-dummy/offlineFirst/" 
  var list = await fetch(url, {
    method: "OPTIONS",
    headers: {
      filelist  : true
    }
  }).then(r => r.json())

  // offlineFirstCache.match("https://lively-kernel.org/lively4S2/lively4-dummy/offlineFirst/bla.txt")
  // list.contents.map(ea => url + ea.name.replace(/^\.\//,""))

  for(let ea of list.contents) {
    var fileURL = url + ea.name.replace(/^.\//,"")
    var cached  = await offlineFirstCache.match(fileURL)
    if (cached) {
      lively.notify("found cached " + fileURL)
    }
  } 

})()
```
Related Work: the Manifest file from the time before the service worker did something similar, or did it?


### Meta: How can we  get a better async/await workspace experience...

- The rewriting failed... because we would have to reorder the variable declarations to make them global.
- #Idea: our contious editor allowed to see the (last or range?) of all variables in the code. If we would have  another run at this problem!

