- From: John-David Dalton <notifications@github.com>
- Date: Mon, 22 Aug 2016 15:17:41 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/commit/e2a6d18647b97707c7a571163eef7838f82ca611/18733>
FWIW I ran into this issue adding offline support to [Lodash's website](https://twitter.com/jdalton/status/767058211689988096). <a href="https://github.com/lodash/lodash.github.io/blob/cb3d58d46265d31155dd06074766bb170a352134/sw.js#L17-L24"><img src="https://cloud.githubusercontent.com/assets/4303/17873587/35d93df6-687b-11e6-8491-ad94e0e08adb.png"></a> It was puzzling because docs like [MDN Cache.put](https://developer.mozilla.org/en-US/docs/Web/API/Cache/put) state > Often, you will just want to fetch() one or more requests, then add the result straight to your cache. In such cases you are better off just using Cache.add/Cache.addAll, as they are shorthand functions for one or more of these operations: ```js fetch(url).then(function (response) { return cache.put(url, response); }) ``` Or [Cache.add](https://developer.mozilla.org/en-US/docs/Web/API/Cache/add) which states > The add() method of the Cache interface takes a URL, retrieves it and adds the resulting response object to the given cache. The add() method is functionally equivalent to the following: ```js fetch(url).then(function (response) { return cache.put(url, response); }) ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/commit/e2a6d18647b97707c7a571163eef7838f82ca611#commitcomment-18733803
Received on Monday, 22 August 2016 22:18:17 UTC