workbox-strategies
Advanced tools
Comparing version 3.0.0-beta.0 to 3.0.0-beta.1
this.workbox = this.workbox || {}; | ||
this.workbox.strategies = (function (cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,assert_mjs,logger_mjs) { | ||
this.workbox.strategies = (function (logger_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,assert_mjs) { | ||
'use strict'; | ||
try { | ||
self.workbox.v['workbox:strategies:3.0.0-beta.0'] = 1; | ||
self.workbox.v['workbox:strategies:3.0.0-beta.1'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -33,3 +33,3 @@ | ||
var messages = { | ||
strategyStart: (strategyName, event) => `Using ${strategyName} to repond ` + `to '${getFriendlyURL(event.request.url)}'`, | ||
strategyStart: (strategyName, event) => `Using ${strategyName} to respond ` + `to '${getFriendlyURL(event.request.url)}'`, | ||
printFinalResponse: response => { | ||
@@ -399,3 +399,12 @@ if (response) { | ||
const response = yield Promise.race(promises); | ||
// Promise.race() will resolve as soon as the first promise resolves. | ||
let response = yield Promise.race(promises); | ||
// If Promise.race() resolved with null, it might be due to a network | ||
// timeout + a cache miss. If that were to happen, we'd rather wait until | ||
// the networkPromise resolves instead of returning null. | ||
// Note that it's fine to await an already-resolved promise, so we don't | ||
// have to check to see if it's still "in flight". | ||
if (!response) { | ||
response = yield networkPromise; | ||
} | ||
@@ -756,3 +765,2 @@ { | ||
var publicAPI = Object.freeze({ | ||
@@ -759,0 +767,0 @@ CacheFirst: CacheFirst, |
@@ -1,3 +0,3 @@ | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.0.0-beta.0"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);if(!s)try{s=yield r.r(e)}catch(e){n=e}if(n)throw n;return s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t),i=s.clone();return e.waitUntil(t.cacheWrapper.put(n.e,e.request,i,n.t)),s})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield t.cacheWrapper.match(r.e,e.request,null,r.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.n=t.networkTimeoutSeconds}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=[],n=[];let s;if(t.n){const{id:i,promise:l}=t.s(e,r);s=i,n.push(l)}const i=t.i(s,e,r);n.push(i);return yield Promise.race(n)})()}s(e,t){var r=this;let n;const s=new Promise(t=>{const s=(()=>{var n=babelHelpers.asyncToGenerator(function*(){t(yield r.l(e.request))});return function(){return n.apply(this,arguments)}})();n=setTimeout(s,1e3*this.n)});return{promise:s,id:n}}i(e,n,s){var i=this;return babelHelpers.asyncToGenerator(function*(){let s,l;try{l=yield r.fetchWrapper.fetch(n.request,i.t)}catch(e){s=e}if(e&&clearTimeout(e),s||!l)l=yield i.l(n.request);else{const e=l.clone();n.waitUntil(t.cacheWrapper.put(i.e,n.request,e,i.t))}return l})()}l(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class o{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){let n,s;try{s=yield r.fetchWrapper.fetch(e.request,null,t.t)}catch(e){n=e}if(n)throw n;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]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.r(e);let s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);return s?e.waitUntil(n):s=yield n,s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t);return e.waitUntil(t.cacheWrapper.put(n.e,e.request,s.clone(),n.t)),s})()}}var u=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:l,NetworkOnly:o,StaleWhileRevalidate:c});const a={cacheFirst:n,cacheOnly:s,networkFirst:l,networkOnly:o,staleWhileRevalidate:c},h={};Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})});return Object.assign(h,u)}(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.0.0-beta.1"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);if(!s)try{s=yield r.r(e)}catch(e){n=e}if(n)throw n;return s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t),l=s.clone();return e.waitUntil(t.cacheWrapper.put(n.e,e.request,l,n.t)),s})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield t.cacheWrapper.match(r.e,e.request,null,r.t)})()}}var l={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class i{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:[l,...t.plugins]}else this.t=[l];this.n=t.networkTimeoutSeconds}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=[],n=[];let s;if(t.n){const{id:l,promise:i}=t.s(e,r);s=l,n.push(i)}const l=t.l(s,e,r);n.push(l);let i=yield Promise.race(n);return i||(i=yield l),i})()}s(e,t){var r=this;let n;const s=new Promise(t=>{const s=(()=>{var n=babelHelpers.asyncToGenerator(function*(){t(yield r.i(e.request))});return function(){return n.apply(this,arguments)}})();n=setTimeout(s,1e3*this.n)});return{promise:s,id:n}}l(e,n,s){var l=this;return babelHelpers.asyncToGenerator(function*(){let s,i;try{i=yield r.fetchWrapper.fetch(n.request,l.t)}catch(e){s=e}if(e&&clearTimeout(e),s||!i)i=yield l.i(n.request);else{const e=i.clone();n.waitUntil(t.cacheWrapper.put(l.e,n.request,e,l.t))}return i})()}i(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class o{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){let n,s;try{s=yield r.fetchWrapper.fetch(e.request,null,t.t)}catch(e){n=e}if(n)throw n;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:[l,...t.plugins]}else this.t=[l]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.r(e);let s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);return s?e.waitUntil(n):s=yield n,s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t);return e.waitUntil(t.cacheWrapper.put(n.e,e.request,s.clone(),n.t)),s})()}}var u=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:i,NetworkOnly:o,StaleWhileRevalidate:c});const a={cacheFirst:n,cacheOnly:s,networkFirst:i,networkOnly:o,staleWhileRevalidate:c},h={};Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})});return Object.assign(h,u)}(workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-strategies.prod.js.map |
{ | ||
"name": "workbox-strategies", | ||
"version": "3.0.0-beta.0", | ||
"version": "3.0.0-beta.1", | ||
"license": "Apache-2.0", | ||
@@ -30,4 +30,4 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^3.0.0-beta.0" | ||
"workbox-core": "^3.0.0-beta.1" | ||
} | ||
} |
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
95995
1626
Updatedworkbox-core@^3.0.0-beta.1