Urara-Blog/node_modules/.pnpm-store/v3/files/09/ad669619b715fd7d4f97ad639613f1ac892c00aa4d3fb796edf0610c36dfad4a200333aae9a886683d890307a2871563e43c00cf4e99e6b7ef625df94e1acf
2022-08-14 01:14:53 +08:00

29 lines
703 B
Text

/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import {WorkboxPlugin} from 'workbox-core/types.js';
import '../_version.js';
export const cacheOkAndOpaquePlugin: WorkboxPlugin = {
/**
* Returns a valid response (to allow caching) if the status is 200 (OK) or
* 0 (opaque).
*
* @param {Object} options
* @param {Response} options.response
* @return {Response|null}
*
* @private
*/
cacheWillUpdate: async ({response}) => {
if (response.status === 200 || response.status === 0) {
return response;
}
return null;
},
};