workbox-strategies
Advanced tools
Comparing version 3.1.0 to 3.2.0
this.workbox = this.workbox || {}; | ||
this.workbox.strategies = (function (logger_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,assert_mjs,getFriendlyURL_mjs) { | ||
this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs) { | ||
'use strict'; | ||
try { | ||
self.workbox.v['workbox:strategies:3.1.0'] = 1; | ||
self.workbox.v['workbox:strategies:3.2.0'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -215,3 +215,9 @@ | ||
if (event) { | ||
event.waitUntil(cachePutPromise); | ||
try { | ||
event.waitUntil(cachePutPromise); | ||
} catch (error) { | ||
{ | ||
logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`); | ||
} | ||
} | ||
} | ||
@@ -924,3 +930,12 @@ | ||
} | ||
event.waitUntil(fetchAndCachePromise); | ||
if (event) { | ||
try { | ||
event.waitUntil(fetchAndCachePromise); | ||
} catch (error) { | ||
{ | ||
logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`); | ||
} | ||
} | ||
} | ||
} else { | ||
@@ -960,4 +975,11 @@ { | ||
const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, response.clone(), _this3._plugins); | ||
if (event) { | ||
event.waitUntil(cachePutPromise); | ||
try { | ||
event.waitUntil(cachePutPromise); | ||
} catch (error) { | ||
{ | ||
logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`); | ||
} | ||
} | ||
} | ||
@@ -964,0 +986,0 @@ |
@@ -1,3 +0,3 @@ | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.1.0"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));let s,i=yield t.cacheWrapper.match(n.e,r,null,n.t);if(!i)try{i=yield n.n(r,e)}catch(e){s=e}if(s)throw s;return i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=i.clone(),u=t.cacheWrapper.put(s.e,e,l,s.t);return n&&n.waitUntil(u),i})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));return yield t.cacheWrapper.match(n.e,r,null,n.t)})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class l{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.networkTimeoutSeconds,this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=[];"string"==typeof t&&(t=new Request(t));const s=[];let i;if(r.s){const{id:e,promise:l}=r.i(t,n);i=e,s.push(l)}const l=r.l(i,e,t,n);s.push(l);let u=yield Promise.race(s);return u||(u=yield l),u})()}i(e,t){var r=this;let n;const s=new Promise(t=>{const s=(()=>{var n=babelHelpers.asyncToGenerator(function*(){t(yield r.u(e))});return function(){return n.apply(this,arguments)}})();n=setTimeout(s,1e3*this.s)});return{promise:s,id:n}}l(e,n,s,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(s,l.r,l.t)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.u(s);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,s,e,l.t);if(n)try{n.waitUntil(r)}catch(e){}}return u})()}u(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof t&&(t=new Request(t));let e,s;try{s=yield r.fetchWrapper.fetch(t,n.r,n.t)}catch(t){e=t}if(e)throw e;return s})()}}class o{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));const s=n.n(r,e);let i=yield t.cacheWrapper.match(n.e,r,null,n.t);return i?e.waitUntil(s):i=yield s,i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=t.cacheWrapper.put(s.e,e,i.clone(),s.t);return n&&n.waitUntil(l),i})()}}var c=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:o});const a={cacheFirst:n,cacheOnly:s,networkFirst:l,networkOnly:u,staleWhileRevalidate:o},h={};Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})});return Object.assign(h,c)}(workbox.core._private,workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.2.0"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));let s,i=yield t.cacheWrapper.match(n.e,r,null,n.t);if(!i)try{i=yield n.n(r,e)}catch(e){s=e}if(s)throw s;return i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=i.clone(),u=t.cacheWrapper.put(s.e,e,l,s.t);if(n)try{n.waitUntil(u)}catch(e){}return i})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof r&&(r=new Request(r)),yield t.cacheWrapper.match(n.e,r,null,n.t)})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class l{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.networkTimeoutSeconds,this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=[];"string"==typeof t&&(t=new Request(t));const s=[];let i;if(r.s){const{id:e,promise:l}=r.i(t,n);i=e,s.push(l)}const l=r.l(i,e,t,n);s.push(l);let u=yield Promise.race(s);return u||(u=yield l),u})()}i(e,t){var r=this;let n;var s;return{promise:new Promise(t=>{const i=(s=babelHelpers.asyncToGenerator(function*(){t(yield r.u(e))}),function(){return s.apply(this,arguments)});n=setTimeout(i,1e3*this.s)}),id:n}}l(e,n,s,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(s,l.r,l.t)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.u(s);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,s,e,l.t);if(n)try{n.waitUntil(r)}catch(e){}}return u})()}u(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var n=this;return babelHelpers.asyncToGenerator(function*(){let e,s;"string"==typeof t&&(t=new Request(t));try{s=yield r.fetchWrapper.fetch(t,n.r,n.t)}catch(t){e=t}if(e)throw e;return s})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));const s=n.n(r,e);let i=yield t.cacheWrapper.match(n.e,r,null,n.t);if(i){if(e)try{e.waitUntil(s)}catch(e){}}else i=yield s;return i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=t.cacheWrapper.put(s.e,e,i.clone(),s.t);if(n)try{n.waitUntil(l)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:c});const a={cacheFirst:n,cacheOnly:s,networkFirst:l,networkOnly:u,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-strategies.prod.js.map |
{ | ||
"name": "workbox-strategies", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"license": "Apache-2.0", | ||
@@ -30,4 +30,4 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^3.1.0" | ||
"workbox-core": "^3.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123087
2056
29
Updatedworkbox-core@^3.2.0