workbox-strategies
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-alpha.2
// @ts-ignore | ||
try { | ||
self['workbox:strategies:5.0.0-alpha.1'] && _(); | ||
self['workbox:strategies:5.0.0-alpha.2'] && _(); | ||
} | ||
catch (e) { } |
@@ -7,3 +7,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self['workbox:strategies:5.0.0-alpha.1'] && _(); | ||
self['workbox:strategies:5.0.0-alpha.2'] && _(); | ||
} catch (e) {} | ||
@@ -85,34 +85,4 @@ | ||
}) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {Event} [options.event] If provided, `event.waitUntil()` will | ||
be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ | ||
event, | ||
request | ||
}) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
{ | ||
@@ -274,32 +244,2 @@ assert_js.assert.isInstance(request, Request, { | ||
}) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ | ||
event, | ||
request | ||
}) { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
{ | ||
@@ -460,34 +400,4 @@ assert_js.assert.isInstance(request, Request, { | ||
}) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ | ||
event, | ||
request | ||
}) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
{ | ||
@@ -755,32 +665,2 @@ assert_js.assert.isInstance(request, Request, { | ||
}) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ | ||
event, | ||
request | ||
}) { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
{ | ||
@@ -906,34 +786,4 @@ assert_js.assert.isInstance(request, Request, { | ||
}) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ | ||
event, | ||
request | ||
}) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
{ | ||
@@ -940,0 +790,0 @@ assert_js.assert.isInstance(request, Request, { |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s,n,r){"use strict";try{self["workbox:strategies:5.0.0-alpha.1"]&&_()}catch(e){}class i{constructor(e={}){this.t=t.cacheNames.getRuntimeName(e.cacheName),this.s=e.plugins||[],this.i=e.fetchOptions,this.h=e.matchOptions}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));let n,i=await s.cacheWrapper.match({cacheName:this.t,request:t,event:e,matchOptions:this.h,plugins:this.s});if(!i)try{i=await this.o(t,e)}catch(e){n=e}if(!i)throw new r.WorkboxError("no-response",{url:t.url,error:n});return i}async o(e,t){const r=await n.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s}),i=r.clone(),h=s.cacheWrapper.put({cacheName:this.t,request:e,response:i,event:t,plugins:this.s});if(t)try{t.waitUntil(h)}catch(e){}return r}}class h{constructor(e={}){this.t=t.cacheNames.getRuntimeName(e.cacheName),this.s=e.plugins||[],this.h=e.matchOptions}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));const n=await s.cacheWrapper.match({cacheName:this.t,request:t,event:e,matchOptions:this.h,plugins:this.s});if(!n)throw new r.WorkboxError("no-response",{url:t.url});return n}}const a={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};class c{constructor(e={}){if(this.t=t.cacheNames.getRuntimeName(e.cacheName),e.plugins){let t=e.plugins.some(e=>!!e.cacheWillUpdate);this.s=t?e.plugins:[a,...e.plugins]}else this.s=[a];this.u=e.networkTimeoutSeconds||0,this.i=e.fetchOptions,this.h=e.matchOptions}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(this.u){const{id:r,promise:h}=this.l({request:t,event:e,logs:s});i=r,n.push(h)}const h=this.q({timeoutId:i,request:t,event:e,logs:s});n.push(h);let a=await Promise.race(n);if(a||(a=await h),!a)throw new r.WorkboxError("no-response",{url:t.url});return a}l({request:e,logs:t,event:s}){let n;return{promise:new Promise(t=>{n=setTimeout(async()=>{t(await this.p({request:e,event:s}))},1e3*this.u)}),id:n}}async q({timeoutId:e,request:t,logs:r,event:i}){let h,a;try{a=await n.fetchWrapper.fetch({request:t,event:i,fetchOptions:this.i,plugins:this.s})}catch(e){h=e}if(e&&clearTimeout(e),h||!a)a=await this.p({request:t,event:i});else{const e=a.clone(),n=s.cacheWrapper.put({cacheName:this.t,request:t,response:e,event:i,plugins:this.s});if(i)try{i.waitUntil(n)}catch(e){}}return a}p({event:e,request:t}){return s.cacheWrapper.match({cacheName:this.t,request:t,event:e,matchOptions:this.h,plugins:this.s})}}class o{constructor(e={}){this.s=e.plugins||[],this.i=e.fetchOptions}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){let s,i;"string"==typeof t&&(t=new Request(t));try{i=await n.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s})}catch(e){s=e}if(!i)throw new r.WorkboxError("no-response",{url:t.url,error:s});return i}}class u{constructor(e={}){if(this.t=t.cacheNames.getRuntimeName(e.cacheName),this.s=e.plugins||[],e.plugins){let t=e.plugins.some(e=>!!e.cacheWillUpdate);this.s=t?e.plugins:[a,...e.plugins]}else this.s=[a];this.i=e.fetchOptions,this.h=e.matchOptions}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));const n=this.o({request:t,event:e});let i,h=await s.cacheWrapper.match({cacheName:this.t,request:t,event:e,matchOptions:this.h,plugins:this.s});if(h){if(e)try{e.waitUntil(n)}catch(i){}}else try{h=await n}catch(e){i=e}if(!h)throw new r.WorkboxError("no-response",{url:t.url,error:i});return h}async o({request:e,event:t}){const r=await n.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s}),i=s.cacheWrapper.put({cacheName:this.t,request:e,response:r.clone(),event:t,plugins:this.s});if(t)try{t.waitUntil(i)}catch(e){}return r}}const l={cacheFirst:i,cacheOnly:h,networkFirst:c,networkOnly:o,staleWhileRevalidate:u},q=e=>{const t=l[e];return e=>new t(e)},w=q("cacheFirst"),p=q("cacheOnly"),v=q("networkFirst"),y=q("networkOnly"),m=q("staleWhileRevalidate");return e.CacheFirst=i,e.CacheOnly=h,e.NetworkFirst=c,e.NetworkOnly=o,e.StaleWhileRevalidate=u,e.cacheFirst=w,e.cacheOnly=p,e.networkFirst=v,e.networkOnly=y,e.staleWhileRevalidate=m,e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,i,r){"use strict";try{self["workbox:strategies:5.0.0-alpha.2"]&&_()}catch(t){}class n{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){let i,n=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!n)try{n=await this.o(e,t)}catch(t){i=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:i});return n}async o(t,e){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=r.clone(),h=s.cacheWrapper.put({cacheName:this.t,request:t,response:n,event:e,plugins:this.s});if(e)try{e.waitUntil(h)}catch(t){}return r}}class h{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.h=t.matchOptions}async handle({event:t,request:e}){const i=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!i)throw new r.WorkboxError("no-response",{url:e.url});return i}}const c={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};class a{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.u=t.networkTimeoutSeconds||0,this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const s=[],i=[];let n;if(this.u){const{id:r,promise:h}=this.l({request:e,event:t,logs:s});n=r,i.push(h)}const h=this.p({timeoutId:n,request:e,event:t,logs:s});i.push(h);let c=await Promise.race(i);if(c||(c=await h),!c)throw new r.WorkboxError("no-response",{url:e.url});return c}l({request:t,logs:e,event:s}){let i;return{promise:new Promise(e=>{i=setTimeout(async()=>{e(await this.v({request:t,event:s}))},1e3*this.u)}),id:i}}async p({timeoutId:t,request:e,logs:r,event:n}){let h,c;try{c=await i.fetchWrapper.fetch({request:e,event:n,fetchOptions:this.i,plugins:this.s})}catch(t){h=t}if(t&&clearTimeout(t),h||!c)c=await this.v({request:e,event:n});else{const t=c.clone(),i=s.cacheWrapper.put({cacheName:this.t,request:e,response:t,event:n,plugins:this.s});if(n)try{n.waitUntil(i)}catch(t){}}return c}v({event:t,request:e}){return s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s})}}class o{constructor(t={}){this.s=t.plugins||[],this.i=t.fetchOptions}async handle({event:t,request:e}){let s,n;try{n=await i.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s})}catch(t){s=t}if(!n)throw new r.WorkboxError("no-response",{url:e.url,error:s});return n}}class u{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[c,...t.plugins]}else this.s=[c];this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const i=this.o({request:e,event:t});let n,h=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(h){if(t)try{t.waitUntil(i)}catch(n){}}else try{h=await i}catch(t){n=t}if(!h)throw new r.WorkboxError("no-response",{url:e.url,error:n});return h}async o({request:t,event:e}){const r=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),n=s.cacheWrapper.put({cacheName:this.t,request:t,response:r.clone(),event:e,plugins:this.s});if(e)try{e.waitUntil(n)}catch(t){}return r}}const l={cacheFirst:n,cacheOnly:h,networkFirst:a,networkOnly:o,staleWhileRevalidate:u},w=t=>{const e=l[t];return t=>new e(t)},p=w("cacheFirst"),v=w("cacheOnly"),m=w("networkFirst"),q=w("networkOnly"),y=w("staleWhileRevalidate");return t.CacheFirst=n,t.CacheOnly=h,t.NetworkFirst=a,t.NetworkOnly=o,t.StaleWhileRevalidate=u,t.cacheFirst=p,t.cacheOnly=v,t.networkFirst=m,t.networkOnly=q,t.staleWhileRevalidate=y,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-strategies.prod.js.map |
@@ -52,21 +52,2 @@ import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {Event} [options.event] If provided, `event.waitUntil()` will | ||
be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
makeRequest({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response>; | ||
/** | ||
* Handles the network and cache part of CacheFirst. | ||
@@ -73,0 +54,0 @@ * |
@@ -60,27 +60,3 @@ /* | ||
async handle({ event, request }) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {Event} [options.event] If provided, `event.waitUntil()` will | ||
be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ event, request }) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -87,0 +63,0 @@ assert.isInstance(request, Request, { |
@@ -45,22 +45,3 @@ import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
handle({ event, request }: RouteHandlerCallbackOptions): Promise<Response>; | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
makeRequest({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response>; | ||
} | ||
export { CacheOnly }; |
@@ -53,26 +53,2 @@ /* | ||
async handle({ event, request }) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ event, request }) { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -79,0 +55,0 @@ assert.isInstance(request, Request, { |
@@ -62,22 +62,3 @@ import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
makeRequest({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response>; | ||
/** | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
@@ -90,10 +71,3 @@ * @param {Array} options.logs A reference to the logs array | ||
*/ | ||
_getTimeoutPromise({ request, logs, event }: { | ||
request: Request; | ||
logs: any[]; | ||
event?: ExtendableEvent; | ||
}): { | ||
promise: Promise<Response | undefined>; | ||
id?: number; | ||
}; | ||
private _getTimeoutPromise; | ||
/** | ||
@@ -125,7 +99,4 @@ * @param {Object} options | ||
*/ | ||
_respondFromCache({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response | undefined>; | ||
private _respondFromCache; | ||
} | ||
export { NetworkFirst }; |
@@ -88,27 +88,3 @@ /* | ||
async handle({ event, request }) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ event, request }) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -115,0 +91,0 @@ assert.isInstance(request, Request, { |
@@ -45,22 +45,3 @@ import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
handle({ event, request }: RouteHandlerCallbackOptions): Promise<Response>; | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
makeRequest({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response>; | ||
} | ||
export { NetworkOnly }; |
@@ -53,26 +53,2 @@ /* | ||
async handle({ event, request }) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ event, request }) { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -79,0 +55,0 @@ assert.isInstance(request, Request, { |
{ | ||
"name": "workbox-strategies", | ||
"version": "5.0.0-alpha.1", | ||
"version": "5.0.0-alpha.2", | ||
"license": "MIT", | ||
@@ -31,6 +31,6 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^5.0.0-alpha.1", | ||
"workbox-routing": "^5.0.0-alpha.1" | ||
"workbox-core": "^5.0.0-alpha.2", | ||
"workbox-routing": "^5.0.0-alpha.2" | ||
}, | ||
"gitHead": "20d2110ddace710a46af06addd4977cae08f5942" | ||
"gitHead": "0cb0029b692c3802545238fe59b6d6179ca32f6c" | ||
} |
// @ts-ignore | ||
try{self['workbox:strategies:5.0.0-alpha.1']&&_()}catch(e){} | ||
try{self['workbox:strategies:5.0.0-alpha.2']&&_()}catch(e){} |
@@ -77,33 +77,4 @@ /* | ||
async handle({event, request}: RouteHandlerCallbackOptions): Promise<Response> { | ||
return this.makeRequest({ | ||
event, | ||
request: request || (event as FetchEvent).request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {Event} [options.event] If provided, `event.waitUntil()` will | ||
be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({event, request}: { | ||
request: Request, | ||
event?: ExtendableEvent | ||
}): Promise<Response> { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -110,0 +81,0 @@ assert!.isInstance(request, Request, { |
@@ -68,31 +68,2 @@ /* | ||
async handle({event, request}: RouteHandlerCallbackOptions): Promise<Response> { | ||
return this.makeRequest({ | ||
event, | ||
request: request || (event as FetchEvent).request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({event, request}: { | ||
request: Request, | ||
event?: ExtendableEvent | ||
}): Promise<Response> { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -99,0 +70,0 @@ assert!.isInstance(request, Request, { |
@@ -110,33 +110,4 @@ /* | ||
async handle({event, request}: RouteHandlerCallbackOptions): Promise<Response> { | ||
return this.makeRequest({ | ||
event, | ||
request: request || (event as FetchEvent).request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({event, request}: { | ||
request: Request, | ||
event?: ExtendableEvent | ||
}): Promise<Response> { | ||
const logs: any[] = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -200,3 +171,3 @@ assert!.isInstance(request, Request, { | ||
*/ | ||
_getTimeoutPromise({request, logs, event}: { | ||
private _getTimeoutPromise({request, logs, event}: { | ||
request: Request, | ||
@@ -319,3 +290,3 @@ logs: any[], | ||
*/ | ||
_respondFromCache({event, request}: { | ||
private _respondFromCache({event, request}: { | ||
request: Request, | ||
@@ -322,0 +293,0 @@ event?: ExtendableEvent, |
@@ -66,31 +66,2 @@ /* | ||
async handle({event, request}: RouteHandlerCallbackOptions): Promise<Response> { | ||
return this.makeRequest({ | ||
event, | ||
request: request || (event as FetchEvent).request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({event, request}: { | ||
request: Request, | ||
event?: ExtendableEvent | ||
}): Promise<Response> { | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -97,0 +68,0 @@ assert!.isInstance(request, Request, { |
@@ -96,32 +96,4 @@ /* | ||
async handle({event, request}: RouteHandlerCallbackOptions): Promise<Response> { | ||
return this.makeRequest({ | ||
event, | ||
request: request || (event as FetchEvent).request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({event, request}: { | ||
request: Request, | ||
event?: ExtendableEvent | ||
}): Promise<Response> { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -128,0 +100,0 @@ assert!.isInstance(request, Request, { |
@@ -59,22 +59,3 @@ import { RouteHandler, RouteHandlerCallbackOptions, WorkboxPlugin } from 'workbox-core/types.js'; | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
makeRequest({ event, request }: { | ||
request: Request; | ||
event?: ExtendableEvent; | ||
}): Promise<Response>; | ||
/** | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
@@ -81,0 +62,0 @@ * @param {Event} [options.event] |
@@ -77,27 +77,3 @@ /* | ||
async handle({ event, request }) { | ||
return this.makeRequest({ | ||
event, | ||
request: request || event.request, | ||
}); | ||
} | ||
/** | ||
* This method can be used to perform a make a standalone request outside the | ||
* context of the [Workbox Router]{@link workbox.routing.Router}. | ||
* | ||
* See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)" | ||
* for more usage information. | ||
* | ||
* @param {Object} options | ||
* @param {Request|string} options.request Either a | ||
* [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request} | ||
* object, or a string URL, corresponding to the request to be made. | ||
* @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will | ||
* be called automatically to extend the service worker's lifetime. | ||
* @return {Promise<Response>} | ||
*/ | ||
async makeRequest({ event, request }) { | ||
const logs = []; | ||
if (typeof request === 'string') { | ||
request = new Request(request); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -104,0 +80,0 @@ assert.isInstance(request, Request, { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
241155
3085