workbox-strategies
Advanced tools
Comparing version 6.4.2 to 6.5.0
"use strict"; | ||
// @ts-ignore | ||
try { | ||
self['workbox:strategies:6.4.1'] && _(); | ||
self['workbox:strategies:6.4.2'] && _(); | ||
} | ||
catch (e) { } |
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self['workbox:strategies:6.4.1'] && _(); | ||
self['workbox:strategies:6.4.2'] && _(); | ||
} catch (e) {} | ||
@@ -23,8 +23,8 @@ | ||
* A class created every time a Strategy instance instance calls | ||
* [handle()]{@link module:workbox-strategies.Strategy~handle} or | ||
* [handleAll()]{@link module:workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* {@link workbox-strategies.Strategy~handle} or | ||
* {@link workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* cache actions around plugin callbacks and keeps track of when the strategy | ||
* is "done" (i.e. all added `event.waitUntil()` promises have resolved). | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -41,3 +41,3 @@ | ||
* | ||
* @param {module:workbox-strategies.Strategy} strategy | ||
* @param {workbox-strategies.Strategy} strategy | ||
* @param {Object} options | ||
@@ -48,5 +48,4 @@ * @param {Request|string} options.request A request to run this strategy for. | ||
* @param {URL} [options.url] | ||
* @param {*} [options.params] | ||
* [match callback]{@link module:workbox-routing~matchCallback}, | ||
* (if applicable). | ||
* @param {*} [options.params] The return value from the | ||
* {@link workbox-routing~matchCallback} (if applicable). | ||
*/ | ||
@@ -61,3 +60,3 @@ constructor(strategy, options) { | ||
* @type {Request} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -70,3 +69,3 @@ | ||
* @type {ExtendableEvent} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -82,3 +81,3 @@ | ||
* @type {URL|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -91,3 +90,3 @@ | ||
* from a workbox `Route` object and the | ||
* [match callback]{@link module:workbox-routing~matchCallback} returned | ||
* {@link workbox-routing~matchCallback} returned | ||
* a truthy value (it will be that value). | ||
@@ -97,3 +96,3 @@ * @name params | ||
* @type {*|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -447,3 +446,3 @@ | ||
* the next callback. See | ||
* [`iterateCallbacks()`]{@link module:workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* {@link workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* below for how to handle that case. | ||
@@ -501,3 +500,3 @@ * | ||
* Note: you can await | ||
* [`doneWaiting()`]{@link module:workbox-strategies.StrategyHandler~doneWaiting} | ||
* {@link workbox-strategies.StrategyHandler~doneWaiting} | ||
* to know when all added promises have settled. | ||
@@ -517,3 +516,3 @@ * | ||
* Returns a promise that resolves once all promises passed to | ||
* [`waitUntil()`]{@link module:workbox-strategies.StrategyHandler~waitUntil} | ||
* {@link workbox-strategies.StrategyHandler~waitUntil} | ||
* have settled. | ||
@@ -606,3 +605,3 @@ * | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -622,3 +621,3 @@ | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -638,3 +637,3 @@ * to use in conjunction with this caching strategy. | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* | ||
@@ -677,3 +676,3 @@ * @type {string} | ||
* When a strategy instance is registered with a Workbox | ||
* [route]{@link module:workbox-routing.Route}, this method is automatically | ||
* {@link workbox-routing.Route}, this method is automatically | ||
* called when the route matches. | ||
@@ -699,5 +698,5 @@ * | ||
/** | ||
* Similar to [`handle()`]{@link module:workbox-strategies.Strategy~handle}, but | ||
* Similar to {@link workbox-strategies.Strategy~handle}, but | ||
* instead of just returning a `Promise` that resolves to a `Response` it | ||
* it will return an tuple of [response, done] promises, where the former | ||
* it will return an tuple of `[response, done]` promises, where the former | ||
* (`response`) is equivalent to what `handle()` returns, and the latter is a | ||
@@ -839,3 +838,3 @@ * Promise that will resolve once any promises that were added to | ||
* Classes extending the `Strategy` based class should implement this method, | ||
* and leverage the [`handler`]{@link module:workbox-strategies.StrategyHandler} | ||
* and leverage the {@link workbox-strategies.StrategyHandler} | ||
* arg to perform all fetching and cache logic, which will ensure all relevant | ||
@@ -850,6 +849,6 @@ * cache, cache options, fetch options and plugins are used (per the current | ||
* @param {Request} request | ||
* @param {module:workbox-strategies.StrategyHandler} handler | ||
* @param {workbox-strategies.StrategyHandler} handler | ||
* @return {Promise<Response>} | ||
* | ||
* @memberof module:workbox-strategies.Strategy | ||
* @memberof workbox-strategies.Strategy | ||
*/ | ||
@@ -893,4 +892,4 @@ | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -902,3 +901,3 @@ | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -988,4 +987,4 @@ * @return {Promise<Response>} | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -997,3 +996,3 @@ | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -1087,4 +1086,4 @@ * @return {Promise<Response>} | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -1097,3 +1096,3 @@ | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -1137,3 +1136,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -1318,4 +1317,4 @@ * @return {Promise<Response>} | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -1342,3 +1341,3 @@ | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -1431,4 +1430,4 @@ * @return {Promise<Response>} | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -1441,3 +1440,3 @@ | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -1462,3 +1461,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -1484,2 +1483,3 @@ * @return {Promise<Response>} | ||
}); | ||
void handler.waitUntil(fetchAndCachePromise); | ||
let response = await handler.cacheMatch(request); | ||
@@ -1486,0 +1486,0 @@ let error; |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,r,n,i,a,o,c){"use strict";try{self["workbox:strategies:6.4.1"]&&_()}catch(t){}function h(t){return"string"==typeof t?new Request(t):t}class l{constructor(t,e){this.yt={},Object.assign(this,e),this.event=e.event,this.ot=t,this.vt=new n.Deferred,this.qt=[],this.bt=[...t.plugins],this.Et=new Map;for(const t of this.bt)this.Et.set(t,{});this.event.waitUntil(this.vt.promise)}async fetch(t){const{event:s}=this;let r=h(t);if("navigate"===r.mode&&s instanceof FetchEvent&&s.preloadResponse){const t=await s.preloadResponse;if(t)return t}const n=this.hasCallback("fetchDidFail")?r.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))r=await t({request:r.clone(),event:s})}catch(t){if(t instanceof Error)throw new e.WorkboxError("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=r.clone();try{let t;t=await fetch(r,"navigate"===r.mode?void 0:this.ot.fetchOptions);for(const e of this.iterateCallbacks("fetchDidSucceed"))t=await e({event:s,request:i,response:t});return t}catch(t){throw n&&await this.runCallbacks("fetchDidFail",{error:t,event:s,originalRequest:n.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=h(t);let s;const{cacheName:r,matchOptions:n}=this.ot,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},n),{cacheName:r});s=await caches.match(i,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:r,matchOptions:n,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(t,s){const n=h(t);await c.timeout(0);const o=await this.getCacheKey(n,"write");if(!s)throw new e.WorkboxError("cache-put-with-no-response",{url:a.getFriendlyURL(o.url)});const l=await this._t(s);if(!l)return!1;const{cacheName:w,matchOptions:u}=this.ot,f=await self.caches.open(w),d=this.hasCallback("cacheDidUpdate"),p=d?await r.cacheMatchIgnoreParams(f,o.clone(),["__WB_REVISION__"],u):null;try{await f.put(o,d?l.clone():l)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await i.executeQuotaErrorCallbacks(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:w,oldResponse:p,newResponse:l.clone(),request:o,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.yt[s]){let r=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))r=h(await t({mode:e,request:r,event:this.event,params:this.params}));this.yt[s]=r}return this.yt[s]}hasCallback(t){for(const e of this.ot.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.ot.plugins)if("function"==typeof e[t]){const s=this.Et.get(e),r=r=>{const n=Object.assign(Object.assign({},r),{state:s});return e[t](n)};yield r}}waitUntil(t){return this.qt.push(t),t}async doneWaiting(){let t;for(;t=this.qt.shift();)await t}destroy(){this.vt.resolve(null)}async _t(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class w{constructor(t={}){this.cacheName=s.cacheNames.getRuntimeName(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,r="params"in t?t.params:void 0,n=new l(this,{event:e,request:s,params:r}),i=this.kt(n,s,e);return[i,this.xt(i,n,s,e)]}async kt(t,s,r){await t.runCallbacks("handlerWillStart",{event:r,request:s});let n=void 0;try{if(n=await this._handle(s,t),!n||"error"===n.type)throw new e.WorkboxError("no-response",{url:s.url})}catch(e){if(e instanceof Error)for(const i of t.iterateCallbacks("handlerDidError"))if(n=await i({error:e,event:r,request:s}),n)break;if(!n)throw e}for(const e of t.iterateCallbacks("handlerWillRespond"))n=await e({event:r,request:s,response:n});return n}async xt(t,e,s,r){let n,i;try{n=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:r,request:s,response:n}),await e.doneWaiting()}catch(t){t instanceof Error&&(i=t)}if(await e.runCallbacks("handlerDidComplete",{event:r,request:s,response:n,error:i}),e.destroy(),i)throw i}}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};return t.CacheFirst=class extends w{async _handle(t,s){let r=await s.cacheMatch(t),n=void 0;if(!r)try{r=await s.fetchAndCachePut(t)}catch(t){t instanceof Error&&(n=t)}if(!r)throw new e.WorkboxError("no-response",{url:t.url,error:n});return r}},t.CacheOnly=class extends w{async _handle(t,s){const r=await s.cacheMatch(t);if(!r)throw new e.WorkboxError("no-response",{url:t.url});return r}},t.NetworkFirst=class extends w{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u),this.Rt=t.networkTimeoutSeconds||0}async _handle(t,s){const r=[],n=[];let i;if(this.Rt){const{id:e,promise:a}=this.Wt({request:t,logs:r,handler:s});i=e,n.push(a)}const a=this.Ot({timeoutId:i,request:t,logs:r,handler:s});n.push(a);const o=await s.waitUntil((async()=>await s.waitUntil(Promise.race(n))||await a)());if(!o)throw new e.WorkboxError("no-response",{url:t.url});return o}Wt({request:t,logs:e,handler:s}){let r;return{promise:new Promise((e=>{r=setTimeout((async()=>{e(await s.cacheMatch(t))}),1e3*this.Rt)})),id:r}}async Ot({timeoutId:t,request:e,logs:s,handler:r}){let n,i;try{i=await r.fetchAndCachePut(e)}catch(t){t instanceof Error&&(n=t)}return t&&clearTimeout(t),!n&&i||(i=await r.cacheMatch(e)),i}},t.NetworkOnly=class extends w{constructor(t={}){super(t),this.Rt=t.networkTimeoutSeconds||0}async _handle(t,s){let r,n=void 0;try{const e=[s.fetch(t)];if(this.Rt){const t=c.timeout(1e3*this.Rt);e.push(t)}if(r=await Promise.race(e),!r)throw new Error("Timed out the network response after "+this.Rt+" seconds.")}catch(t){t instanceof Error&&(n=t)}if(!r)throw new e.WorkboxError("no-response",{url:t.url,error:n});return r}},t.StaleWhileRevalidate=class extends w{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u)}async _handle(t,s){const r=s.fetchAndCachePut(t).catch((()=>{}));let n,i=await s.cacheMatch(t);if(i);else try{i=await r}catch(t){t instanceof Error&&(n=t)}if(!i)throw new e.WorkboxError("no-response",{url:t.url,error:n});return i}},t.Strategy=w,t.StrategyHandler=l,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,r,n,i,a,o,c){"use strict";try{self["workbox:strategies:6.4.2"]&&_()}catch(t){}function h(t){return"string"==typeof t?new Request(t):t}class l{constructor(t,e){this.yt={},Object.assign(this,e),this.event=e.event,this.at=t,this.vt=new n.Deferred,this.bt=[],this.Et=[...t.plugins],this._t=new Map;for(const t of this.Et)this._t.set(t,{});this.event.waitUntil(this.vt.promise)}async fetch(t){const{event:s}=this;let r=h(t);if("navigate"===r.mode&&s instanceof FetchEvent&&s.preloadResponse){const t=await s.preloadResponse;if(t)return t}const n=this.hasCallback("fetchDidFail")?r.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))r=await t({request:r.clone(),event:s})}catch(t){if(t instanceof Error)throw new e.WorkboxError("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=r.clone();try{let t;t=await fetch(r,"navigate"===r.mode?void 0:this.at.fetchOptions);for(const e of this.iterateCallbacks("fetchDidSucceed"))t=await e({event:s,request:i,response:t});return t}catch(t){throw n&&await this.runCallbacks("fetchDidFail",{error:t,event:s,originalRequest:n.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=h(t);let s;const{cacheName:r,matchOptions:n}=this.at,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},n),{cacheName:r});s=await caches.match(i,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:r,matchOptions:n,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(t,s){const n=h(t);await c.timeout(0);const o=await this.getCacheKey(n,"write");if(!s)throw new e.WorkboxError("cache-put-with-no-response",{url:a.getFriendlyURL(o.url)});const l=await this.kt(s);if(!l)return!1;const{cacheName:w,matchOptions:u}=this.at,f=await self.caches.open(w),d=this.hasCallback("cacheDidUpdate"),p=d?await r.cacheMatchIgnoreParams(f,o.clone(),["__WB_REVISION__"],u):null;try{await f.put(o,d?l.clone():l)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await i.executeQuotaErrorCallbacks(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:w,oldResponse:p,newResponse:l.clone(),request:o,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.yt[s]){let r=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))r=h(await t({mode:e,request:r,event:this.event,params:this.params}));this.yt[s]=r}return this.yt[s]}hasCallback(t){for(const e of this.at.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.at.plugins)if("function"==typeof e[t]){const s=this._t.get(e),r=r=>{const n=Object.assign(Object.assign({},r),{state:s});return e[t](n)};yield r}}waitUntil(t){return this.bt.push(t),t}async doneWaiting(){let t;for(;t=this.bt.shift();)await t}destroy(){this.vt.resolve(null)}async kt(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class w{constructor(t={}){this.cacheName=s.cacheNames.getRuntimeName(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,r="params"in t?t.params:void 0,n=new l(this,{event:e,request:s,params:r}),i=this.xt(n,s,e);return[i,this.Rt(i,n,s,e)]}async xt(t,s,r){await t.runCallbacks("handlerWillStart",{event:r,request:s});let n=void 0;try{if(n=await this._handle(s,t),!n||"error"===n.type)throw new e.WorkboxError("no-response",{url:s.url})}catch(e){if(e instanceof Error)for(const i of t.iterateCallbacks("handlerDidError"))if(n=await i({error:e,event:r,request:s}),n)break;if(!n)throw e}for(const e of t.iterateCallbacks("handlerWillRespond"))n=await e({event:r,request:s,response:n});return n}async Rt(t,e,s,r){let n,i;try{n=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:r,request:s,response:n}),await e.doneWaiting()}catch(t){t instanceof Error&&(i=t)}if(await e.runCallbacks("handlerDidComplete",{event:r,request:s,response:n,error:i}),e.destroy(),i)throw i}}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};return t.CacheFirst=class extends w{async _handle(t,s){let r=await s.cacheMatch(t),n=void 0;if(!r)try{r=await s.fetchAndCachePut(t)}catch(t){t instanceof Error&&(n=t)}if(!r)throw new e.WorkboxError("no-response",{url:t.url,error:n});return r}},t.CacheOnly=class extends w{async _handle(t,s){const r=await s.cacheMatch(t);if(!r)throw new e.WorkboxError("no-response",{url:t.url});return r}},t.NetworkFirst=class extends w{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u),this.Wt=t.networkTimeoutSeconds||0}async _handle(t,s){const r=[],n=[];let i;if(this.Wt){const{id:e,promise:a}=this.Ot({request:t,logs:r,handler:s});i=e,n.push(a)}const a=this.Ut({timeoutId:i,request:t,logs:r,handler:s});n.push(a);const o=await s.waitUntil((async()=>await s.waitUntil(Promise.race(n))||await a)());if(!o)throw new e.WorkboxError("no-response",{url:t.url});return o}Ot({request:t,logs:e,handler:s}){let r;return{promise:new Promise((e=>{r=setTimeout((async()=>{e(await s.cacheMatch(t))}),1e3*this.Wt)})),id:r}}async Ut({timeoutId:t,request:e,logs:s,handler:r}){let n,i;try{i=await r.fetchAndCachePut(e)}catch(t){t instanceof Error&&(n=t)}return t&&clearTimeout(t),!n&&i||(i=await r.cacheMatch(e)),i}},t.NetworkOnly=class extends w{constructor(t={}){super(t),this.Wt=t.networkTimeoutSeconds||0}async _handle(t,s){let r,n=void 0;try{const e=[s.fetch(t)];if(this.Wt){const t=c.timeout(1e3*this.Wt);e.push(t)}if(r=await Promise.race(e),!r)throw new Error("Timed out the network response after "+this.Wt+" seconds.")}catch(t){t instanceof Error&&(n=t)}if(!r)throw new e.WorkboxError("no-response",{url:t.url,error:n});return r}},t.StaleWhileRevalidate=class extends w{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u)}async _handle(t,s){const r=s.fetchAndCachePut(t).catch((()=>{}));s.waitUntil(r);let n,i=await s.cacheMatch(t);if(i);else try{i=await r}catch(t){t instanceof Error&&(n=t)}if(!i)throw new e.WorkboxError("no-response",{url:t.url,error:n});return i}},t.Strategy=w,t.StrategyHandler=l,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private); | ||
//# sourceMappingURL=workbox-strategies.prod.js.map |
@@ -15,4 +15,4 @@ import { Strategy } from './Strategy.js'; | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -23,3 +23,3 @@ declare class CacheFirst extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -26,0 +26,0 @@ * @return {Promise<Response>} |
@@ -25,4 +25,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -33,3 +33,3 @@ class CacheFirst extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -36,0 +36,0 @@ * @return {Promise<Response>} |
@@ -14,4 +14,4 @@ import { Strategy } from './Strategy.js'; | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -22,3 +22,3 @@ declare class CacheOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -25,0 +25,0 @@ * @return {Promise<Response>} |
@@ -24,4 +24,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -32,3 +32,3 @@ class CacheOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -35,0 +35,0 @@ * @return {Promise<Response>} |
@@ -20,4 +20,4 @@ import { Strategy, StrategyOptions } from './Strategy.js'; | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -30,3 +30,3 @@ declare class NetworkFirst extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -50,3 +50,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -53,0 +53,0 @@ * @return {Promise<Response>} |
@@ -28,4 +28,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -37,3 +37,3 @@ class NetworkFirst extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -75,3 +75,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -78,0 +78,0 @@ * @return {Promise<Response>} |
@@ -17,4 +17,4 @@ import { Strategy, StrategyOptions } from './Strategy.js'; | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -38,3 +38,3 @@ declare class NetworkOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -41,0 +41,0 @@ * @return {Promise<Response>} |
@@ -25,4 +25,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -48,3 +48,3 @@ class NetworkOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -51,0 +51,0 @@ * @return {Promise<Response>} |
{ | ||
"name": "workbox-strategies", | ||
"version": "6.4.2", | ||
"version": "6.5.0", | ||
"license": "MIT", | ||
@@ -26,5 +26,5 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "6.4.2" | ||
"workbox-core": "6.5.0" | ||
}, | ||
"gitHead": "9fae1320327a3a75bf71df9a76708978bd252428" | ||
"gitHead": "d796009eadcba556b2795e0fea7d71a241f535e0" | ||
} |
// @ts-ignore | ||
try{self['workbox:strategies:6.4.2']&&_()}catch(e){} | ||
try{self['workbox:strategies:6.5.0']&&_()}catch(e){} |
@@ -29,4 +29,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -37,3 +37,3 @@ class CacheFirst extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -40,0 +40,0 @@ * @return {Promise<Response>} |
@@ -28,4 +28,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -36,3 +36,3 @@ class CacheOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -39,0 +39,0 @@ * @return {Promise<Response>} |
@@ -36,4 +36,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -47,3 +47,3 @@ class NetworkFirst extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -88,3 +88,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -91,0 +91,0 @@ * @return {Promise<Response>} |
@@ -34,4 +34,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -61,3 +61,3 @@ class NetworkOnly extends Strategy { | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -64,0 +64,0 @@ * @return {Promise<Response>} |
@@ -37,4 +37,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -46,3 +46,3 @@ class StaleWhileRevalidate extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -69,3 +69,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -90,2 +90,3 @@ * @return {Promise<Response>} | ||
}); | ||
void handler.waitUntil(fetchAndCachePromise); | ||
@@ -92,0 +93,0 @@ let response = await handler.cacheMatch(request); |
@@ -33,3 +33,3 @@ /* | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -58,3 +58,3 @@ abstract class Strategy implements RouteHandlerObject { | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -74,3 +74,3 @@ * to use in conjunction with this caching strategy. | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* | ||
@@ -111,3 +111,3 @@ * @type {string} | ||
* When a strategy instance is registered with a Workbox | ||
* [route]{@link module:workbox-routing.Route}, this method is automatically | ||
* {@link workbox-routing.Route}, this method is automatically | ||
* called when the route matches. | ||
@@ -132,5 +132,5 @@ * | ||
/** | ||
* Similar to [`handle()`]{@link module:workbox-strategies.Strategy~handle}, but | ||
* Similar to {@link workbox-strategies.Strategy~handle}, but | ||
* instead of just returning a `Promise` that resolves to a `Response` it | ||
* it will return an tuple of [response, done] promises, where the former | ||
* it will return an tuple of `[response, done]` promises, where the former | ||
* (`response`) is equivalent to what `handle()` returns, and the latter is a | ||
@@ -280,3 +280,3 @@ * Promise that will resolve once any promises that were added to | ||
* Classes extending the `Strategy` based class should implement this method, | ||
* and leverage the [`handler`]{@link module:workbox-strategies.StrategyHandler} | ||
* and leverage the {@link workbox-strategies.StrategyHandler} | ||
* arg to perform all fetching and cache logic, which will ensure all relevant | ||
@@ -291,6 +291,6 @@ * cache, cache options, fetch options and plugins are used (per the current | ||
* @param {Request} request | ||
* @param {module:workbox-strategies.StrategyHandler} handler | ||
* @param {workbox-strategies.StrategyHandler} handler | ||
* @return {Promise<Response>} | ||
* | ||
* @memberof module:workbox-strategies.Strategy | ||
* @memberof workbox-strategies.Strategy | ||
*/ |
@@ -33,8 +33,8 @@ /* | ||
* A class created every time a Strategy instance instance calls | ||
* [handle()]{@link module:workbox-strategies.Strategy~handle} or | ||
* [handleAll()]{@link module:workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* {@link workbox-strategies.Strategy~handle} or | ||
* {@link workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* cache actions around plugin callbacks and keeps track of when the strategy | ||
* is "done" (i.e. all added `event.waitUntil()` promises have resolved). | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -62,3 +62,3 @@ class StrategyHandler { | ||
* | ||
* @param {module:workbox-strategies.Strategy} strategy | ||
* @param {workbox-strategies.Strategy} strategy | ||
* @param {Object} options | ||
@@ -69,5 +69,4 @@ * @param {Request|string} options.request A request to run this strategy for. | ||
* @param {URL} [options.url] | ||
* @param {*} [options.params] | ||
* [match callback]{@link module:workbox-routing~matchCallback}, | ||
* (if applicable). | ||
* @param {*} [options.params] The return value from the | ||
* {@link workbox-routing~matchCallback} (if applicable). | ||
*/ | ||
@@ -81,3 +80,3 @@ constructor(strategy: Strategy, options: HandlerCallbackOptions) { | ||
* @type {Request} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -89,3 +88,3 @@ /** | ||
* @type {ExtendableEvent} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -100,3 +99,3 @@ /** | ||
* @type {URL|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -108,3 +107,3 @@ /** | ||
* from a workbox `Route` object and the | ||
* [match callback]{@link module:workbox-routing~matchCallback} returned | ||
* {@link workbox-routing~matchCallback} returned | ||
* a truthy value (it will be that value). | ||
@@ -114,3 +113,3 @@ * @name params | ||
* @type {*|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -495,3 +494,3 @@ if (process.env.NODE_ENV !== 'production') { | ||
* the next callback. See | ||
* [`iterateCallbacks()`]{@link module:workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* {@link workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* below for how to handle that case. | ||
@@ -551,3 +550,3 @@ * | ||
* Note: you can await | ||
* [`doneWaiting()`]{@link module:workbox-strategies.StrategyHandler~doneWaiting} | ||
* {@link workbox-strategies.StrategyHandler~doneWaiting} | ||
* to know when all added promises have settled. | ||
@@ -565,3 +564,3 @@ * | ||
* Returns a promise that resolves once all promises passed to | ||
* [`waitUntil()`]{@link module:workbox-strategies.StrategyHandler~waitUntil} | ||
* {@link workbox-strategies.StrategyHandler~waitUntil} | ||
* have settled. | ||
@@ -568,0 +567,0 @@ * |
@@ -22,4 +22,4 @@ import { Strategy, StrategyOptions } from './Strategy.js'; | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -31,3 +31,3 @@ declare class StaleWhileRevalidate extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -45,3 +45,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -48,0 +48,0 @@ * @return {Promise<Response>} |
@@ -33,4 +33,4 @@ /* | ||
* | ||
* @extends module:workbox-strategies.Strategy | ||
* @memberof module:workbox-strategies | ||
* @extends workbox-strategies.Strategy | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -42,3 +42,3 @@ class StaleWhileRevalidate extends Strategy { | ||
* requests. Defaults to cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -63,3 +63,3 @@ * to use in conjunction with this caching strategy. | ||
* @param {Request|string} request A request to run this strategy for. | ||
* @param {module:workbox-strategies.StrategyHandler} handler The event that | ||
* @param {workbox-strategies.StrategyHandler} handler The event that | ||
* triggered the request. | ||
@@ -82,2 +82,3 @@ * @return {Promise<Response>} | ||
}); | ||
void handler.waitUntil(fetchAndCachePromise); | ||
let response = await handler.cacheMatch(request); | ||
@@ -84,0 +85,0 @@ let error; |
@@ -13,3 +13,3 @@ import { HandlerCallbackOptions, RouteHandlerObject, WorkboxPlugin } from 'workbox-core/types.js'; | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -33,3 +33,3 @@ declare abstract class Strategy implements RouteHandlerObject { | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -51,3 +51,3 @@ * to use in conjunction with this caching strategy. | ||
* When a strategy instance is registered with a Workbox | ||
* [route]{@link module:workbox-routing.Route}, this method is automatically | ||
* {@link workbox-routing.Route}, this method is automatically | ||
* called when the route matches. | ||
@@ -68,5 +68,5 @@ * | ||
/** | ||
* Similar to [`handle()`]{@link module:workbox-strategies.Strategy~handle}, but | ||
* Similar to {@link workbox-strategies.Strategy~handle}, but | ||
* instead of just returning a `Promise` that resolves to a `Response` it | ||
* it will return an tuple of [response, done] promises, where the former | ||
* it will return an tuple of `[response, done]` promises, where the former | ||
* (`response`) is equivalent to what `handle()` returns, and the latter is a | ||
@@ -97,3 +97,3 @@ * Promise that will resolve once any promises that were added to | ||
* Classes extending the `Strategy` based class should implement this method, | ||
* and leverage the [`handler`]{@link module:workbox-strategies.StrategyHandler} | ||
* and leverage the {@link workbox-strategies.StrategyHandler} | ||
* arg to perform all fetching and cache logic, which will ensure all relevant | ||
@@ -108,6 +108,6 @@ * cache, cache options, fetch options and plugins are used (per the current | ||
* @param {Request} request | ||
* @param {module:workbox-strategies.StrategyHandler} handler | ||
* @param {workbox-strategies.StrategyHandler} handler | ||
* @return {Promise<Response>} | ||
* | ||
* @memberof module:workbox-strategies.Strategy | ||
* @memberof workbox-strategies.Strategy | ||
*/ |
@@ -17,3 +17,3 @@ /* | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -32,3 +32,3 @@ class Strategy { | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins} | ||
@@ -48,3 +48,3 @@ * to use in conjunction with this caching strategy. | ||
* requests. Defaults to the cache names provided by | ||
* [workbox-core]{@link module:workbox-core.cacheNames}. | ||
* {@link workbox-core.cacheNames}. | ||
* | ||
@@ -84,3 +84,3 @@ * @type {string} | ||
* When a strategy instance is registered with a Workbox | ||
* [route]{@link module:workbox-routing.Route}, this method is automatically | ||
* {@link workbox-routing.Route}, this method is automatically | ||
* called when the route matches. | ||
@@ -104,5 +104,5 @@ * | ||
/** | ||
* Similar to [`handle()`]{@link module:workbox-strategies.Strategy~handle}, but | ||
* Similar to {@link workbox-strategies.Strategy~handle}, but | ||
* instead of just returning a `Promise` that resolves to a `Response` it | ||
* it will return an tuple of [response, done] promises, where the former | ||
* it will return an tuple of `[response, done]` promises, where the former | ||
* (`response`) is equivalent to what `handle()` returns, and the latter is a | ||
@@ -219,3 +219,3 @@ * Promise that will resolve once any promises that were added to | ||
* Classes extending the `Strategy` based class should implement this method, | ||
* and leverage the [`handler`]{@link module:workbox-strategies.StrategyHandler} | ||
* and leverage the {@link workbox-strategies.StrategyHandler} | ||
* arg to perform all fetching and cache logic, which will ensure all relevant | ||
@@ -230,6 +230,6 @@ * cache, cache options, fetch options and plugins are used (per the current | ||
* @param {Request} request | ||
* @param {module:workbox-strategies.StrategyHandler} handler | ||
* @param {workbox-strategies.StrategyHandler} handler | ||
* @return {Promise<Response>} | ||
* | ||
* @memberof module:workbox-strategies.Strategy | ||
* @memberof workbox-strategies.Strategy | ||
*/ |
@@ -6,8 +6,8 @@ import { HandlerCallbackOptions, WorkboxPlugin, WorkboxPluginCallbackParam } from 'workbox-core/types.js'; | ||
* A class created every time a Strategy instance instance calls | ||
* [handle()]{@link module:workbox-strategies.Strategy~handle} or | ||
* [handleAll()]{@link module:workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* {@link workbox-strategies.Strategy~handle} or | ||
* {@link workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* cache actions around plugin callbacks and keeps track of when the strategy | ||
* is "done" (i.e. all added `event.waitUntil()` promises have resolved). | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -32,3 +32,3 @@ declare class StrategyHandler { | ||
* | ||
* @param {module:workbox-strategies.Strategy} strategy | ||
* @param {workbox-strategies.Strategy} strategy | ||
* @param {Object} options | ||
@@ -39,5 +39,4 @@ * @param {Request|string} options.request A request to run this strategy for. | ||
* @param {URL} [options.url] | ||
* @param {*} [options.params] | ||
* [match callback]{@link module:workbox-routing~matchCallback}, | ||
* (if applicable). | ||
* @param {*} [options.params] The return value from the | ||
* {@link workbox-routing~matchCallback} (if applicable). | ||
*/ | ||
@@ -127,3 +126,3 @@ constructor(strategy: Strategy, options: HandlerCallbackOptions); | ||
* the next callback. See | ||
* [`iterateCallbacks()`]{@link module:workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* {@link workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* below for how to handle that case. | ||
@@ -154,3 +153,3 @@ * | ||
* Note: you can await | ||
* [`doneWaiting()`]{@link module:workbox-strategies.StrategyHandler~doneWaiting} | ||
* {@link workbox-strategies.StrategyHandler~doneWaiting} | ||
* to know when all added promises have settled. | ||
@@ -164,3 +163,3 @@ * | ||
* Returns a promise that resolves once all promises passed to | ||
* [`waitUntil()`]{@link module:workbox-strategies.StrategyHandler~waitUntil} | ||
* {@link workbox-strategies.StrategyHandler~waitUntil} | ||
* have settled. | ||
@@ -167,0 +166,0 @@ * |
@@ -22,8 +22,8 @@ /* | ||
* A class created every time a Strategy instance instance calls | ||
* [handle()]{@link module:workbox-strategies.Strategy~handle} or | ||
* [handleAll()]{@link module:workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* {@link workbox-strategies.Strategy~handle} or | ||
* {@link workbox-strategies.Strategy~handleAll} that wraps all fetch and | ||
* cache actions around plugin callbacks and keeps track of when the strategy | ||
* is "done" (i.e. all added `event.waitUntil()` promises have resolved). | ||
* | ||
* @memberof module:workbox-strategies | ||
* @memberof workbox-strategies | ||
*/ | ||
@@ -38,3 +38,3 @@ class StrategyHandler { | ||
* | ||
* @param {module:workbox-strategies.Strategy} strategy | ||
* @param {workbox-strategies.Strategy} strategy | ||
* @param {Object} options | ||
@@ -45,5 +45,4 @@ * @param {Request|string} options.request A request to run this strategy for. | ||
* @param {URL} [options.url] | ||
* @param {*} [options.params] | ||
* [match callback]{@link module:workbox-routing~matchCallback}, | ||
* (if applicable). | ||
* @param {*} [options.params] The return value from the | ||
* {@link workbox-routing~matchCallback} (if applicable). | ||
*/ | ||
@@ -58,3 +57,3 @@ constructor(strategy, options) { | ||
* @type {Request} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -66,3 +65,3 @@ /** | ||
* @type {ExtendableEvent} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -77,3 +76,3 @@ /** | ||
* @type {URL|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -85,3 +84,3 @@ /** | ||
* from a workbox `Route` object and the | ||
* [match callback]{@link module:workbox-routing~matchCallback} returned | ||
* {@link workbox-routing~matchCallback} returned | ||
* a truthy value (it will be that value). | ||
@@ -91,3 +90,3 @@ * @name params | ||
* @type {*|undefined} | ||
* @memberof module:workbox-strategies.StrategyHandler | ||
* @memberof workbox-strategies.StrategyHandler | ||
*/ | ||
@@ -399,3 +398,3 @@ if (process.env.NODE_ENV !== 'production') { | ||
* the next callback. See | ||
* [`iterateCallbacks()`]{@link module:workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* {@link workbox-strategies.StrategyHandler#iterateCallbacks} | ||
* below for how to handle that case. | ||
@@ -445,3 +444,3 @@ * | ||
* Note: you can await | ||
* [`doneWaiting()`]{@link module:workbox-strategies.StrategyHandler~doneWaiting} | ||
* {@link workbox-strategies.StrategyHandler~doneWaiting} | ||
* to know when all added promises have settled. | ||
@@ -458,3 +457,3 @@ * | ||
* Returns a promise that resolves once all promises passed to | ||
* [`waitUntil()`]{@link module:workbox-strategies.StrategyHandler~waitUntil} | ||
* {@link workbox-strategies.StrategyHandler~waitUntil} | ||
* have settled. | ||
@@ -461,0 +460,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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances 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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
368757
4793
+ Addedworkbox-core@6.5.0(transitive)
- Removedworkbox-core@6.4.2(transitive)
Updatedworkbox-core@6.5.0